git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] fixup! log: add exhaustive tests for pattern style options & config

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 16, 2017, 06:15 UTC
Message-ID
<CACBZZX4GZnpVzhL-bDSxmsH_JWZjxOPzpEYyZC=d+wLPLs6Kpg@mail.gmail.com>
In-Reply-To
<xmqq37c56334.fsf@gitster.mtv.corp.google.com>
On Tue, May 16, 2017 at 2:46 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 25 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
>> On Mon, 15 May 2017, Junio C Hamano wrote:
>>
>>> My knee-jerk reaction matched Dscho's, but grep is about contents,
>>> and we should be able to test this if we used a sensible tagnames or
>>> didn't use any.  Glad to see somebody can step back and think ;-)
>>
>> Maybe somebody should step back even further and think even more, as we
>> could adjust test_commit to mangle the argument into a tag name that is
>> legal even with a refs backend relying on NTFS.
>
> Perhaps, but I am not sure if that is needed.
>
> The point of the helper is to serve as a simple "we are building a
> toy sample history by only adding a one-liner new file" convenience
> helper, and I think it is sensible to keep its definition simple.
> The callers (like the ones being added in the rerolled patch under
> discussion) with special needs can supply tagname when the default
> one is not suitable.
>
> In hindsight, perhaps it would have been better if the default for
> the helper were _not_ to create any tag (and callers who care about
> tags can optionally tell it to add tag, or tag the resulting commit
> themselves), but that is lamenting water under the bridge.
This works, but I wonder if it's worth it to solve this one-off issue:
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 5ee124332a..4cab67c410 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -195,7 +195,15 @@ test_commit () {
                test_tick
        fi &&
        git ${indir:+ -C "$indir"} commit $signoff -m "$1" &&
-       git ${indir:+ -C "$indir"} tag "${4:-$1}"
+       if test -n "$4"
+       then
+               git ${indir:+ -C "$indir"} tag "$4"
+       elif test -n "$(echo $1 | tr -d A-Za-z0-9/~_.#-)"
+       then
+               error "Implicitly created tag '$1' looks unusual,
probably fails outside *nix"
+       else
+               git ${indir:+ -C "$indir"} tag "$1"
+       fi
 }

 # Call test_merge with the arguments "<message> <commit>", where <commit>
Previous: Junio C Hamano
Message 11 of 11 in “fixup! log: add exhaustive tests for pattern style options & config”
  1. fixup! log: add exhaustive tests for pattern style options & configJohannes Schindelin, May 12, 2017
  2. Junio C HamanoMay 12, 2017
  3. Jonathan NiederMay 12, 2017
  4. Ævar Arnfjörð BjarmasonMay 13, 2017
  5. Johannes SchindelinMay 13, 2017
  6. Jonathan NiederMay 15, 2017
  7. Ævar Arnfjörð BjarmasonMay 13, 2017
  8. Junio C HamanoMay 15, 2017
  9. Johannes SchindelinMay 15, 2017
  10. Junio C HamanoMay 16, 2017
  11. Ævar Arnfjörð BjarmasonMay 16, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.