Merge pull request #205220 from skyfmmf/stgit-rust

authored by

Janik and committed by
GitHub
e98468ff b82c8e13

+286 -18
+249
pkgs/applications/version-management/stgit/0001-fix-use-canonical-Message-ID-spelling.patch
··· 1 + From c500ebe5a51da4eecba0c88d9a335e7a659e7ecb Mon Sep 17 00:00:00 2001 2 + From: Peter Grayson <pete@jpgrayson.net> 3 + Date: Sun, 18 Jun 2023 15:00:19 -0400 4 + Subject: fix: use canonical Message-ID spelling 5 + 6 + This change aligns with a change in git 2.41.0 to consistently spell 7 + "Message-ID" instead of "Message-Id". 8 + 9 + The test suite is updated to accommodate both spellings, since such headers 10 + are case insensitive. 11 + --- 12 + Documentation/stg.txt | 2 +- 13 + completion/stgit.zsh | 2 +- 14 + src/cmd/email/format.rs | 2 +- 15 + src/cmd/email/send.rs | 2 +- 16 + src/cmd/import.rs | 6 +++--- 17 + t/t1800-import.sh | 2 +- 18 + t/t1801-import-email.sh | 32 ++++++++++++++++---------------- 19 + 7 files changed, 24 insertions(+), 24 deletions(-) 20 + 21 + diff --git a/Documentation/stg.txt b/Documentation/stg.txt 22 + index fb4c08fb..20b75ce2 100644 23 + --- a/Documentation/stg.txt 24 + +++ b/Documentation/stg.txt 25 + @@ -302,7 +302,7 @@ N.B. Set 'commit.gpgsign' to determine whether patch commits themselves are GPG 26 + See linkgit:git-config[1] for more information about 'commit.gpgsign'. 27 + 28 + stgit.import.message-id:: 29 + - When set to 'true', create 'Message-Id:' trailer in the patch description of patches 30 + + When set to 'true', create 'Message-ID:' trailer in the patch description of patches 31 + imported from email using linkstg:import[]. 32 + 33 + stgit.keepoptimized:: 34 + diff --git a/completion/stgit.zsh b/completion/stgit.zsh 35 + index 797d9044..de818242 100644 36 + --- a/completion/stgit.zsh 37 + +++ b/completion/stgit.zsh 38 + @@ -717,7 +717,7 @@ _stg-import() { 39 + '--replace[replace unapplied patches in series]' 40 + '--reject[leave rejected hunks in .rej files]' 41 + '--keep-cr[do not remove CR from email lines ending with CRLF]' 42 + - '--message-id[create Message-Id trailer from email header]' 43 + + '--message-id[create Message-ID trailer from email header]' 44 + '(-d --showdiff)'{-d,--showdiff}'[show patch content in editor buffer]' 45 + ':file:_files' 46 + + '(source)' 47 + diff --git a/src/cmd/email/format.rs b/src/cmd/email/format.rs 48 + index f385b48a..b30af9c0 100644 49 + --- a/src/cmd/email/format.rs 50 + +++ b/src/cmd/email/format.rs 51 + @@ -323,7 +323,7 @@ fn message_options() -> Vec<Arg> { 52 + .long_help( 53 + "Controls addition of `In-Reply-To` and `References` headers to make \ 54 + the second and subsequent mails appear as replies to the first. Also \ 55 + - controls generation of the `Message-Id` header to reference.\n\ 56 + + controls generation of the `Message-ID` header to reference.\n\ 57 + \n\ 58 + The optional <style> argument can be either `shallow` or `deep`. \ 59 + `shallow` threading makes every mail a reply to the head of the \ 60 + diff --git a/src/cmd/email/send.rs b/src/cmd/email/send.rs 61 + index 6904956f..af75f4b3 100644 62 + --- a/src/cmd/email/send.rs 63 + +++ b/src/cmd/email/send.rs 64 + @@ -194,7 +194,7 @@ fn compose_options() -> Vec<Arg> { 65 + .help("Specify the \"In-Reply-To:\" identifier") 66 + .long_help( 67 + "Make the first mail (or all the mails with '--no-thread') appear as a \ 68 + - reply to the given Message-Id, which avoids breaking threads to \ 69 + + reply to the given Message-ID, which avoids breaking threads to \ 70 + provide a new patch series. The second and subsequent emails will be \ 71 + sent as replies according to the '--[no-]chain-reply-to' setting.\n\ 72 + \n\ 73 + diff --git a/src/cmd/import.rs b/src/cmd/import.rs 74 + index d5477df7..2835aefa 100644 75 + --- a/src/cmd/import.rs 76 + +++ b/src/cmd/import.rs 77 + @@ -210,9 +210,9 @@ fn make() -> clap::Command { 78 + .arg( 79 + Arg::new("message-id") 80 + .long("message-id") 81 + - .help("Create Message-Id trailer from Message-ID header") 82 + + .help("Create Message-ID trailer from Message-ID header") 83 + .long_help( 84 + - "Create Message-Id trailer in patch description based on the \ 85 + + "Create Message-ID trailer in patch description based on the \ 86 + Message-ID email header. This option is applicable when importing \ 87 + with '--mail' or '--mbox'. This behavior may also be enabled via \ 88 + the \"stgit.import.message-id\" configuration option.", 89 + @@ -500,7 +500,7 @@ fn import_file<'repo>( 90 + if message.len() > 1 && &message[message.len() - 2..] != b"\n\n" { 91 + message.push(b'\n'); 92 + } 93 + - message.push_str("Message-Id: "); 94 + + message.push_str("Message-ID: "); 95 + message.push_str(message_id); 96 + message.push(b'\n'); 97 + } 98 + diff --git a/t/t1800-import.sh b/t/t1800-import.sh 99 + index ecf0020c..229269bf 100755 100 + --- a/t/t1800-import.sh 101 + +++ b/t/t1800-import.sh 102 + @@ -43,7 +43,7 @@ test_expect_success 'Import patch with email headers' ' 103 + cat >expected <<-\EOF && 104 + body 105 + 106 + - Message-Id: abc123 107 + + Message-ID: abc123 108 + 109 + EOF 110 + test_cmp expected body && 111 + diff --git a/t/t1801-import-email.sh b/t/t1801-import-email.sh 112 + index dbd3f7da..0559e076 100755 113 + --- a/t/t1801-import-email.sh 114 + +++ b/t/t1801-import-email.sh 115 + @@ -17,7 +17,7 @@ test_expect_success 'Apply a patch from an 8bit-encoded e-mail' ' 116 + [ $(git cat-file -p $(stg id) \ 117 + | grep -c "author Inge Ström <inge@power.com>") = 1 ] && 118 + [ $(git cat-file -p $(stg id) \ 119 + - | grep -c "Message-Id: <20061111105814.23209.46952.stgit@localhost>") = 1 ] && 120 + + | grep -c "Message-I[Dd]: <20061111105814.23209.46952.stgit@localhost>") = 1 ] && 121 + stg delete .. 122 + ' 123 + 124 + @@ -28,7 +28,7 @@ test_expect_success !MINGW,STG_IMPORT_URL 'Apply a patch from an 8bit-encoded e- 125 + [ $(git cat-file -p $(stg id) \ 126 + | grep -c "author Inge Ström <inge@power.com>") = 1 ] && 127 + [ $(git cat-file -p $(stg id) \ 128 + - | grep -c "Message-Id: <20061111105814.23209.46952.stgit@localhost>") = 0 ] && 129 + + | grep -c "Message-I[Dd]: <20061111105814.23209.46952.stgit@localhost>") = 0 ] && 130 + stg delete .. 131 + ' 132 + 133 + @@ -40,7 +40,7 @@ test_expect_success 'Apply a patch from an 8bit-encoded e-mail with CRLF endings 134 + [ $(git cat-file -p $(stg id) \ 135 + | grep -c "author Inge Ström <inge@power.com>") = 1 ] && 136 + [ $(git cat-file -p $(stg id) \ 137 + - | grep -c "Message-Id: <20061111105814.23209.46952.stgit@localhost>") = 0 ] && 138 + + | grep -c "Message-I[Dd]: <20061111105814.23209.46952.stgit@localhost>") = 0 ] && 139 + stg delete .. 140 + ' 141 + 142 + @@ -56,7 +56,7 @@ test_expect_success 'Apply e-mail with CRLF endings and --keep-cr' ' 143 + [ $(git cat-file -p $(stg id) \ 144 + | grep -c "author Inge Ström <inge@power.com>") = 1 ] && 145 + [ $(git cat-file -p $(stg id) \ 146 + - | grep -c "Message-Id: <20061111105814.23209.46952.stgit@localhost>") = 0 ] && 147 + + | grep -c "Message-I[Dd]: <20061111105814.23209.46952.stgit@localhost>") = 0 ] && 148 + stg delete .. 149 + ' 150 + 151 + @@ -68,7 +68,7 @@ test_expect_success 'Apply a patch from latin1-encoded email specifying utf-8 ch 152 + [ $(git cat-file -p $(stg id) \ 153 + | grep -c "author Inge Ström <inge@power.com>") = 1 ] && 154 + [ $(git cat-file -p $(stg id) \ 155 + - | grep -c "Message-Id: <20061111105814.23209.46952.stgit@localhost>") = 0 ] && 156 + + | grep -c "Message-I[Dd]: <20061111105814.23209.46952.stgit@localhost>") = 0 ] && 157 + stg delete .. 158 + ' 159 + 160 + @@ -79,7 +79,7 @@ test_expect_success 'Apply a patch from email with quoted "From" header' ' 161 + [ $(git cat-file -p $(stg id) \ 162 + | grep -c "author Inge Ström <inge@power.com>") = 1 ] && 163 + [ $(git cat-file -p $(stg id) \ 164 + - | grep -c "Message-Id: <20061111105814.23209.46952.stgit@localhost>") = 0 ] && 165 + + | grep -c "Message-I[Dd]: <20061111105814.23209.46952.stgit@localhost>") = 0 ] && 166 + stg delete .. 167 + ' 168 + 169 + @@ -90,7 +90,7 @@ test_expect_success 'Apply a patch from a QP-encoded e-mail' ' 170 + [ $(git cat-file -p $(stg id) \ 171 + | grep -c "author Inge Ström <inge@power.com>") = 1 ] && 172 + [ $(git cat-file -p $(stg id) \ 173 + - | grep -c "Message-Id: <20061111105814.23209.46952.stgit@localhost>") = 0 ] && 174 + + | grep -c "Message-I[Dd]: <20061111105814.23209.46952.stgit@localhost>") = 0 ] && 175 + stg delete .. 176 + ' 177 + 178 + @@ -102,19 +102,19 @@ test_expect_success 'Apply several patches from an mbox file' ' 179 + [ $(git cat-file -p $(stg id change-1) \ 180 + | grep -c "author Inge Ström <inge@power.com>") = 1 ] && 181 + [ $(git cat-file -p $(stg id change-1) \ 182 + - | grep -c "Message-Id: <20061111114527.31778.12942.stgit@localhost>") = 1 ] && 183 + + | grep -c "Message-I[Dd]: <20061111114527.31778.12942.stgit@localhost>") = 1 ] && 184 + [ $(git cat-file -p $(stg id change-2) \ 185 + | grep -c "tree e49dbce010ec7f441015a8c64bce0b99108af4cc") = 1 ] && 186 + [ $(git cat-file -p $(stg id change-2) \ 187 + | grep -c "author Inge Ström <inge@power.com>") = 1 ] && 188 + [ $(git cat-file -p $(stg id change-2) \ 189 + - | grep -c "Message-Id: <20061111114527.31778.92851.stgit@localhost>") = 1 ] && 190 + + | grep -c "Message-I[Dd]: <20061111114527.31778.92851.stgit@localhost>") = 1 ] && 191 + [ $(git cat-file -p $(stg id change-3-colon) \ 192 + | grep -c "tree 166bbaf27a44aee21ba78c98822a741e6f7d78f5") = 1 ] && 193 + [ $(git cat-file -p $(stg id change-3-colon) \ 194 + | grep -c "author Inge Ström <inge@power.com>") = 1 ] && 195 + [ $(git cat-file -p $(stg id change-3-colon) \ 196 + - | grep -c "Message-Id: <20061111114527.31778.45876.stgit@localhost>") = 1 ] && 197 + + | grep -c "Message-I[Dd]: <20061111114527.31778.45876.stgit@localhost>") = 1 ] && 198 + stg delete .. 199 + ' 200 + 201 + @@ -126,19 +126,19 @@ test_expect_success !MINGW,STG_IMPORT_URL 'Apply several patches from an mbox ur 202 + [ $(git cat-file -p $(stg id change-1) \ 203 + | grep -c "author Inge Ström <inge@power.com>") = 1 ] && 204 + [ $(git cat-file -p $(stg id change-1) \ 205 + - | grep -c "Message-Id: <20061111114527.31778.12942.stgit@localhost>") = 1 ] && 206 + + | grep -c "Message-I[Dd]: <20061111114527.31778.12942.stgit@localhost>") = 1 ] && 207 + [ $(git cat-file -p $(stg id change-2) \ 208 + | grep -c "tree e49dbce010ec7f441015a8c64bce0b99108af4cc") = 1 ] && 209 + [ $(git cat-file -p $(stg id change-2) \ 210 + | grep -c "author Inge Ström <inge@power.com>") = 1 ] && 211 + [ $(git cat-file -p $(stg id change-2) \ 212 + - | grep -c "Message-Id: <20061111114527.31778.92851.stgit@localhost>") = 1 ] && 213 + + | grep -c "Message-I[Dd]: <20061111114527.31778.92851.stgit@localhost>") = 1 ] && 214 + [ $(git cat-file -p $(stg id change-3-colon) \ 215 + | grep -c "tree 166bbaf27a44aee21ba78c98822a741e6f7d78f5") = 1 ] && 216 + [ $(git cat-file -p $(stg id change-3-colon) \ 217 + | grep -c "author Inge Ström <inge@power.com>") = 1 ] && 218 + [ $(git cat-file -p $(stg id change-3-colon) \ 219 + - | grep -c "Message-Id: <20061111114527.31778.45876.stgit@localhost>") = 1 ] && 220 + + | grep -c "Message-I[Dd]: <20061111114527.31778.45876.stgit@localhost>") = 1 ] && 221 + stg delete .. 222 + ' 223 + 224 + @@ -156,19 +156,19 @@ test_expect_success 'Apply several patches from an mbox file from stdin' ' 225 + [ $(git cat-file -p $(stg id change-1) \ 226 + | grep -c "author Inge Ström <inge@power.com>") = 1 ] && 227 + [ $(git cat-file -p $(stg id change-1) \ 228 + - | grep -c "Message-Id: <20061111114527.31778.12942.stgit@localhost>") = 0 ] && 229 + + | grep -c "Message-I[Dd]: <20061111114527.31778.12942.stgit@localhost>") = 0 ] && 230 + [ $(git cat-file -p $(stg id change-2) \ 231 + | grep -c "tree e49dbce010ec7f441015a8c64bce0b99108af4cc") = 1 ] && 232 + [ $(git cat-file -p $(stg id change-2) \ 233 + | grep -c "author Inge Ström <inge@power.com>") = 1 ] && 234 + [ $(git cat-file -p $(stg id change-2) \ 235 + - | grep -c "Message-Id: <20061111114527.31778.92851.stgit@localhost>") = 0 ] && 236 + + | grep -c "Message-I[Dd]: <20061111114527.31778.92851.stgit@localhost>") = 0 ] && 237 + [ $(git cat-file -p $(stg id change-3-colon) \ 238 + | grep -c "tree 166bbaf27a44aee21ba78c98822a741e6f7d78f5") = 1 ] && 239 + [ $(git cat-file -p $(stg id change-3-colon) \ 240 + | grep -c "author Inge Ström <inge@power.com>") = 1 ] && 241 + [ $(git cat-file -p $(stg id change-3-colon) \ 242 + - | grep -c "Message-Id: <20061111114527.31778.45876.stgit@localhost>") = 0 ] && 243 + + | grep -c "Message-I[Dd]: <20061111114527.31778.45876.stgit@localhost>") = 0 ] && 244 + stg delete .. 245 + ' 246 + 247 + -- 248 + 2.40.1 249 +
+37 -18
pkgs/applications/version-management/stgit/default.nix
··· 1 1 { stdenv 2 2 , lib 3 + , rustPlatform 3 4 , fetchFromGitHub 5 + , pkg-config 4 6 , installShellFiles 5 - , python3Packages 7 + , makeWrapper 6 8 , asciidoc 7 9 , docbook_xsl 8 10 , docbook_xml_dtd_45 11 + , xmlto 12 + , curl 9 13 , git 10 14 , perl 11 - , xmlto 15 + , darwin 12 16 }: 13 17 14 - python3Packages.buildPythonApplication rec { 18 + rustPlatform.buildRustPackage rec { 15 19 pname = "stgit"; 16 - version = "1.5"; 20 + version = "2.3.0"; 17 21 18 22 src = fetchFromGitHub { 19 23 owner = "stacked-git"; 20 24 repo = "stgit"; 21 25 rev = "v${version}"; 22 - sha256 = "sha256-TsJr2Riygz/DZrn6UZMPvq1tTfvl3dFEZZNq2wVj1Nw="; 26 + sha256 = "sha256-pGGLY/Hu62dT3KP9GH9YmPg6hePDoPdijJtmap5gpEA="; 23 27 }; 28 + cargoHash = "sha256-f0MQvCkFYR7ErbBDJ3n0r9ZetKfcWg9twhc4r4EpPS4="; 24 29 25 - nativeBuildInputs = [ installShellFiles asciidoc xmlto docbook_xsl docbook_xml_dtd_45 python3Packages.setuptools ]; 30 + nativeBuildInputs = [ 31 + pkg-config installShellFiles makeWrapper asciidoc xmlto docbook_xsl 32 + docbook_xml_dtd_45 perl 33 + ]; 34 + buildInputs = [ curl ]; 26 35 27 - format = "other"; 36 + nativeCheckInputs = [ 37 + git perl 38 + ] ++ lib.optionals stdenv.isDarwin [ 39 + darwin.system_cmds darwin.libiconv 40 + ]; 28 41 29 - nativeCheckInputs = [ git perl ]; 42 + patches = [ 43 + # Fixes tests, can be removed when stgit 2.3.1 is released 44 + ./0001-fix-use-canonical-Message-ID-spelling.patch 45 + ]; 30 46 31 47 postPatch = '' 32 48 for f in Documentation/*.xsl; do ··· 40 56 substituteInPlace Documentation/texi.xsl \ 41 57 --replace http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd \ 42 58 ${docbook_xml_dtd_45}/xml/dtd/docbook/docbookx.dtd 43 - 44 - cat > stgit/_version.py <<EOF 45 - __version__ = "${version}" 46 - EOF 47 59 ''; 48 60 49 - makeFlags = [ 61 + makeFlags = lib.strings.concatStringsSep " " [ 50 62 "prefix=${placeholder "out"}" 51 63 "MAN_BASE_URL=${placeholder "out"}/share/man" 52 64 "XMLTO_EXTRA=--skip-validation" 65 + "PERL_PATH=${perl}/bin/perl" 53 66 ]; 54 67 55 - buildFlags = [ "all" "doc" ]; 68 + buildPhase = '' 69 + make all ${makeFlags} 70 + ''; 71 + 72 + checkPhase = '' 73 + make test ${makeFlags} 74 + ''; 75 + 76 + installPhase = '' 77 + make install install-man install-html ${makeFlags} 56 78 57 - checkTarget = "test"; 58 - checkFlags = [ "PERL_PATH=${perl}/bin/perl" ]; 79 + wrapProgram $out/bin/stg --prefix PATH : ${lib.makeBinPath [ git ]} 59 80 60 - installTargets = [ "install" "install-doc" "install-html" ]; 61 - postInstall = '' 62 81 installShellCompletion --cmd stg \ 63 82 --fish completion/stg.fish \ 64 83 --bash completion/stgit.bash \