Message ID | pull.1850.v2.git.1736509717426.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 64f3ff3ffcfed10b8b5bf42cda3fc19776fb29f2 |
Headers | show |
Series | [v2] GIT-VERSION-GEN: allow it to be run in parallel | expand |
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes: > * Appended + again, to get the benefit of the .gitignore pattern that > prevents the temporary files from being committed. I had queued an incremental fix-up in my tree on top, which may have been easier to read, but you did the testing on a system that showed the problem earlier, so I'll drop it (together with the v1) and replace them with this one. Thanks. --- >8 --- Subject: [PATCH] Make sure the name of the temporary file ends with "+" To avoid regression by leaving untracked cruft that is not covered by the .gitignore file, match the convention to generate into $name$suffix and then move to $name where $suffix ends with "+", which is used everywhere else in the system. diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 5b49e2d72f..bc11258d9b 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -78,6 +78,8 @@ read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION GIT_PATCH_LEVEL trail $(echo "$GIT_VERSION" 0 0 0 0 | tr '.a-zA-Z-' ' ') EOF +OUTPUT_TMP="$OUTPUT.$$+" + sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \ -e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \ -e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \ @@ -86,11 +88,11 @@ sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \ -e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \ -e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \ -e "s|@GIT_DATE@|$GIT_DATE|" \ - "$INPUT" >"$OUTPUT".$$ + "$INPUT" >"$OUTPUT_TMP" -if ! test -f "$OUTPUT" || ! cmp "$OUTPUT".$$ "$OUTPUT" >/dev/null +if ! test -f "$OUTPUT" || ! cmp "$OUTPUT_TMP" "$OUTPUT" >/dev/null then - mv "$OUTPUT".$$ "$OUTPUT" + mv "$OUTPUT_TMP" "$OUTPUT" else - rm "$OUTPUT".$$ + rm "$OUTPUT_TMP" fi --- 8< --- > GIT-VERSION-GEN | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN > index 6d1cb66d69a..2e2d0811581 100755 > --- a/GIT-VERSION-GEN > +++ b/GIT-VERSION-GEN > @@ -86,11 +86,11 @@ sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \ > -e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \ > -e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \ > -e "s|@GIT_DATE@|$GIT_DATE|" \ > - "$INPUT" >"$OUTPUT"+ > + "$INPUT" >"$OUTPUT".$$+ > > -if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null > +if ! test -f "$OUTPUT" || ! cmp "$OUTPUT".$$+ "$OUTPUT" >/dev/null > then > - mv "$OUTPUT"+ "$OUTPUT" > + mv "$OUTPUT".$$+ "$OUTPUT" > else > - rm "$OUTPUT"+ > + rm "$OUTPUT".$$+ > fi > > base-commit: a60673e9252b08d4eca90543b3729f4798b9aafd
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 6d1cb66d69a..2e2d0811581 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -86,11 +86,11 @@ sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \ -e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \ -e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \ -e "s|@GIT_DATE@|$GIT_DATE|" \ - "$INPUT" >"$OUTPUT"+ + "$INPUT" >"$OUTPUT".$$+ -if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null +if ! test -f "$OUTPUT" || ! cmp "$OUTPUT".$$+ "$OUTPUT" >/dev/null then - mv "$OUTPUT"+ "$OUTPUT" + mv "$OUTPUT".$$+ "$OUTPUT" else - rm "$OUTPUT"+ + rm "$OUTPUT".$$+ fi