From: Junio C Hamano <gitster@pobox.com>
To: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, "Patrick Steinhardt" <ps@pks.im>,
"Martin Ågren" <martin.agren@gmail.com>,
"Johannes Schindelin" <johannes.schindelin@gmx.de>
Subject: Re: [PATCH v2] GIT-VERSION-GEN: allow it to be run in parallel
Date: Fri, 10 Jan 2025 08:55:08 -0800 [thread overview]
Message-ID: <xmqqldvi8v83.fsf@gitster.g> (raw)
In-Reply-To: <pull.1850.v2.git.1736509717426.gitgitgadget@gmail.com> (Johannes Schindelin via GitGitGadget's message of "Fri, 10 Jan 2025 11:48:37 +0000")
"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
prev parent reply other threads:[~2025-01-10 16:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-09 14:24 [PATCH] GIT-VERSION-GEN: allow it to be run in parallel Johannes Schindelin via GitGitGadget
2025-01-09 18:33 ` Martin Ågren
2025-01-09 20:00 ` Junio C Hamano
2025-01-10 11:48 ` [PATCH v2] " Johannes Schindelin via GitGitGadget
2025-01-10 16:55 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqldvi8v83.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=johannes.schindelin@gmx.de \
--cc=martin.agren@gmail.com \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).