Git development
 help / color / mirror / Atom feed
* Re: [PATCH 0/1] revert/cherry-pick: add --show-current-patch option
From: Phillip Wood @ 2023-12-18 16:42 UTC (permalink / raw)
  To: Michael Lohmann, git; +Cc: Michael Lohmann, Elijah Newren
In-Reply-To: <20231218121048.68290-1-mi.al.lohmann@gmail.com>

Hi Michael

On 18/12/2023 12:10, Michael Lohmann wrote:
> Hi,
> I am a lead developer of a small team and quite often I have to
> cherry-pick commits (and sometimes also revert them). When
> cherry-picking multiple commits at once and there is a merge conflict it
> sometimes can be hard to understand what the current patch is trying to
> do in order to resolve the conflict properly. With `rebase` there is
> `--show-current-patch` and since that is quite helpful I would suggest
> to also add this flag also to `cherry-pick` and `revert`.

Thanks for bringing this up I agree it can be very helpful to look at 
the original commit when resolving cherry-pick and revert conflicts. I'm 
in two minds about this change though - I wonder if it'd be better to 
improve the documentation for CHERRY_PICK_HEAD and REVERT_HEAD and tell 
users to run "git show CHERRY_PICK_HEAD" instead. I think the main 
reason we have a "--show-current-patch" option for "rebase" is that 
there are two different implementations of that command and the 
patched-based one of them does not support REBASE_HEAD. That reasoning 
does not apply to "cherry-pick" and "revert" and "--show-current-patch" 
suggests a patch-based implementation which is also not the case for 
these commands.

Best Wishes

Phillip

> Since this is my first contribution to git I am not exactly sure where
> the best place for this functionality is. From my initial understanding
> there are two places where to put the actual invocation of the `show`:
> - Duplicate the code (with the needed adaptations) of builtin/rebase.c
>    in builtin/revert.c
> - Create a central function that shows the respective `*_HEAD` depending
>    on the current `action`.
> 
> In this first draft I went with the second option, since I felt that it
> reduces code duplication and the sequencer already has the action enum
> with exactly those three cases. On the other hand I don’t really have a
> good understanding of the role that this `sequencer` should play and if
> this adds additional coupling that is unwanted. My current impression
> is, that this would be the right place, since this looks to be the core
> of the commands where a user can apply a sequence of commits and in my
> opinion even if additional actions would be added, they could also fail
> and so it would be good to add the `--show-current-patch` option to that
> one as well.
> 
> Side note: my only C(++) experience was ~10 years ago and only for a
> single university course, so my perspective is much more from a general
> architecture point of view than based on any C experience, let alone in
> this code base and so I would be very grateful for criticism!
> 
> 
> Side note: The check for the `REBASE_HEAD` would not be necessary, since
> that is already taken care of in the builtin/rebase.c before.
> Nevertheless I opted for this check, because I would much rather require
> the same preconditions no matter from where I call this function. The
> whole argument parsing / option struct are very different between rebase
> and revert. Maybe it would make sense to align them a bit further?
> Initial observations: `rebase_options->type` is functionally similar to
> `replay_opts->action` (as in "what general action am I performing? -
> interactive rebase / cherry-pick / revert / ...") whereas
> `rebase_options->action` is not part of the `replay_opts` struct at all.
> Instead the role is taken over in builtin/revert.c by `int cmd = 0;`.
> I am preparing a patch converting this to an enum, so that there are
> no random chars that have to be kept in sync manually in different
> places, or is that a design decision?
> 
> I looked through the mailing list archive and did not find anything
> related on this topic. The only slightly related thread I could find was
> in [1] by Elijah Newren and that one was talking about a separate
> possible feature and how to get certain information if CHERRY_PICK_HEAD
> and REVERT_HEAD were to be replaced by a different construct. I hope I
> did not miss something...
> 
> Cheers
> Michael
> 
> [1]:
> https://lore.kernel.org/git/CABPp-BGd-W8T7EsvKYyjdi3=mfSTJ8zM-uzVsFnh1AWyV2wEzQ@mail.gmail.com
> 
> Michael Lohmann (1):
>    revert/cherry-pick: add --show-current-patch option
> 
>   Documentation/git-cherry-pick.txt      |  2 +-
>   Documentation/git-revert.txt           |  2 +-
>   Documentation/sequencer.txt            |  5 +++++
>   builtin/rebase.c                       |  7 ++----
>   builtin/revert.c                       |  9 ++++++--
>   contrib/completion/git-completion.bash |  2 +-
>   sequencer.c                            | 24 +++++++++++++++++++++
>   sequencer.h                            |  2 ++
>   t/t3507-cherry-pick-conflict.sh        | 30 ++++++++++++++++++++++++++
>   9 files changed, 73 insertions(+), 10 deletions(-)
> 

^ permalink raw reply

* Re: [PATCH v2] test-lib-functions.sh: fix test_grep fail message wording
From: Junio C Hamano @ 2023-12-18 16:34 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: Shreyansh Paliwal, git, five231003
In-Reply-To: <CAPig+cSJ=RcJtYKzT0Kj1-0nJT0YxA=KPYV=5H80_inJYS_Vnw@mail.gmail.com>

Eric Sunshine <sunshine@sunshineco.com> writes:

> On Sun, Dec 17, 2023 at 10:32 AM Shreyansh Paliwal
> <shreyanshpaliwalcmsmn@gmail.com> wrote:
>> ping.
>
> Junio was on vacation at the time[1] that this patch was submitted, so
> it's quite possible that it simply got overlooked or he hasn't gotten
> through the backlog of emails which accumulated while he was away.

It was dropped due to automated filter that noticed that the address
on its in-body From: line does not appear on any of its Signed-off-by:
line ;-)

I'll see if that is the only glitch in the patch (in which case I'll
manually adjust the authorship and apply) or respond on list
(otherwise).

Thanks for pinging and ponging.

> So,
> pinging is indeed the correct thing to do, and the patch is obviously
> an improvement, so hopefully it will be picked up soon.
>
> [1]: https://lore.kernel.org/git/xmqq34wj4e55.fsf@gitster.g/

^ permalink raw reply

* Re: [PATCH] rebase-interactive: show revert option and add single letter shortcut
From: Phillip Wood @ 2023-12-18 16:32 UTC (permalink / raw)
  To: Michael Lohmann, git; +Cc: Michael Lohmann, Johannes Schindelin
In-Reply-To: <20231218152313.72896-1-mi.al.lohmann@gmail.com>

Hi Michael

Thanks for the patch, I'm wondering why you want to revert a commit when 
you're rebasing. I think it would be helpful to explain that in the 
commit message. In particular why it is necessary to revert a commit 
rather than simply dropping it (presumably you're using rebase to do 
something more that just rework a series of commits)

Best Wishes

Phillip

On 18/12/2023 15:23, Michael Lohmann wrote:
> Signed-off-by: Michael Lohmann <mi.al.lohmann@gmail.com>
> ---
>   Documentation/git-rebase.txt | 3 +++
>   rebase-interactive.c         | 1 +
>   sequencer.c                  | 2 +-
>   3 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
> index 1dd6555f66..75f6fe39a1 100644
> --- a/Documentation/git-rebase.txt
> +++ b/Documentation/git-rebase.txt
> @@ -911,6 +911,9 @@ commit, the message from the final one is used.  You can also use
>   "fixup -C" to get the same behavior as "fixup -c" except without opening
>   an editor.
>   
> +To revert a commit, add a line starting with "revert" followed by the commit
> +name.
> +
>   `git rebase` will stop when "pick" has been replaced with "edit" or
>   when a command fails due to merge errors. When you are done editing
>   and/or resolving conflicts you can continue with `git rebase --continue`.
> diff --git a/rebase-interactive.c b/rebase-interactive.c
> index d9718409b3..e1fd1e09e3 100644
> --- a/rebase-interactive.c
> +++ b/rebase-interactive.c
> @@ -53,6 +53,7 @@ void append_todo_help(int command_count,
>   "                   commit's log message, unless -C is used, in which case\n"
>   "                   keep only this commit's message; -c is same as -C but\n"
>   "                   opens the editor\n"
> +"v, revert <commit> = revert the changes introduced by that commit\n"
>   "x, exec <command> = run command (the rest of the line) using shell\n"
>   "b, break = stop here (continue rebase later with 'git rebase --continue')\n"
>   "d, drop <commit> = remove commit\n"
> diff --git a/sequencer.c b/sequencer.c
> index d584cac8ed..3c18f71ed6 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -1767,7 +1767,7 @@ static struct {
>   	const char *str;
>   } todo_command_info[] = {
>   	[TODO_PICK] = { 'p', "pick" },
> -	[TODO_REVERT] = { 0,   "revert" },
> +	[TODO_REVERT] = { 'v', "revert" },
>   	[TODO_EDIT] = { 'e', "edit" },
>   	[TODO_REWORD] = { 'r', "reword" },
>   	[TODO_FIXUP] = { 'f', "fixup" },

^ permalink raw reply

* Re: [PATCH 1/5] git.txt: HEAD is not that special
From: Junio C Hamano @ 2023-12-18 16:26 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: git
In-Reply-To: <ZYAGyLH4nm4TebA_@tanuki>

Patrick Steinhardt <ps@pks.im> writes:

>>  Named pointers called refs mark interesting points in history.  A ref
>> -may contain the SHA-1 name of an object or the name of another ref.  Refs
>> -with names beginning `ref/head/` contain the SHA-1 name of the most
>> +may contain the SHA-1 name of an object or the name of another ref (the
>> +latter is called a "symbolic ref").
>
> On a tangent: While we have a name for symbolic refs, do we also have a
> name for non-symbolic refs? I often use the term "direct ref" to clearly
> distinguish them from symbolic refs, but it's of course not defined in
> our glossary.

You may find me saying "normal ref", "regular ref", or somesuch when
it is not clear from the context if you dig the list archive.
"direct" is a nice word, especially it would give us a good pair of
terms if we are to change "symbolic" to "indirect", but since we are
not going to do so, I am not sure the contrast between "direct" and
"symbolic" would make such a good pair.

But quite honestly I rarely felt a need for a specific term, as it
is fairly clear from the context, e.g.

 * "From a ref, we locate an object using the object name it
   records and use the object"

   A statement written from the point of view of the consumer of
   object name, it does not matter if the object name is directly
   found in the ref, or indirection is involved to find such a
   concrete ref that records an object name by following the
   original symbolic ref.

 * "A ref usually stores an object name, but it can also be a
   symbolic ref that points at another ref, in which case, asking
   what object such a symbolic ref points at would yield the object
   the other ref points at".

So I dunno.

>> +Refs with names beginning `ref/head/` contain the SHA-1 name of the most
>>  recent commit (or "head") of a branch under development.  SHA-1 names of
>> -tags of interest are stored under `ref/tags/`.  A special ref named
>> +tags of interest are stored under `ref/tags/`.  A symbolic ref named
>>  `HEAD` contains the name of the currently checked-out branch.
>
> I was briefly wondering whether we also want to replace SHA-1 with
> "object hash" while at it, but it's certainly out of the scope of this
> patch series.

Yup, there still are too many reference to SHA-1 (and "sha1", which
is even worse), and it is not a focus of this series.

Thanks.

^ permalink raw reply

* Re: [PATCH] git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool
From: Phillip Wood @ 2023-12-18 16:23 UTC (permalink / raw)
  To: René Scharfe, git
  Cc: AtariDreams via GitGitGadget, Seija Kijin, Junio C Hamano,
	Jeff King, Phillip Wood
In-Reply-To: <2d30dc36-6091-4b47-846f-92d3f4a8b135@web.de>

Hi René

On 16/12/2023 10:47, René Scharfe wrote:
> Use the data type bool and its values true and false to document the
> binary return value of skip_prefix() and friends more explicitly.
> 
> This first use of stdbool.h, introduced with C99, is meant to check
> whether there are platforms that claim support for C99, as tested by
> 7bc341e21b (git-compat-util: add a test balloon for C99 support,
> 2021-12-01), but still lack that header for some reason.
> 
> A fallback based on a wider type, e.g. int, would have to deal with
> comparisons somehow to emulate that any non-zero value is true:
> 
>     bool b1 = 1;
>     bool b2 = 2;
>     if (b1 == b2) puts("This is true.");
> 
>     int i1 = 1;
>     int i2 = 2;
>     if (i1 == i2) puts("Not printed.");
>     #define BOOLEQ(a, b) (!(a) == !(b))
>     if (BOOLEQ(i1, i2)) puts("This is true.");
> 
> So we'd be better off using bool everywhere without a fallback, if
> possible.  That's why this patch doesn't include any.

Thanks for the comprehensive commit message, I agree that we'd be better 
off avoiding adding a fallback. The patch looks good, I did wonder if we 
really need to covert all of these functions for a test-balloon but the 
patch is still pretty small overall.

Best Wishes

Phillip

> Signed-off-by: René Scharfe <l.s.r@web.de>
> ---
>   git-compat-util.h | 42 ++++++++++++++++++++++--------------------
>   1 file changed, 22 insertions(+), 20 deletions(-)
> 
> diff --git a/git-compat-util.h b/git-compat-util.h
> index 3e7a59b5ff..603c97e3b3 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -225,6 +225,7 @@ struct strbuf;
>   #include <stddef.h>
>   #include <stdlib.h>
>   #include <stdarg.h>
> +#include <stdbool.h>
>   #include <string.h>
>   #ifdef HAVE_STRINGS_H
>   #include <strings.h> /* for strcasecmp() */
> @@ -684,11 +685,11 @@ report_fn get_warn_routine(void);
>   void set_die_is_recursing_routine(int (*routine)(void));
> 
>   /*
> - * If the string "str" begins with the string found in "prefix", return 1.
> + * If the string "str" begins with the string found in "prefix", return true.
>    * The "out" parameter is set to "str + strlen(prefix)" (i.e., to the point in
>    * the string right after the prefix).
>    *
> - * Otherwise, return 0 and leave "out" untouched.
> + * Otherwise, return false and leave "out" untouched.
>    *
>    * Examples:
>    *
> @@ -699,57 +700,58 @@ void set_die_is_recursing_routine(int (*routine)(void));
>    *   [skip prefix if present, otherwise use whole string]
>    *   skip_prefix(name, "refs/heads/", &name);
>    */
> -static inline int skip_prefix(const char *str, const char *prefix,
> -			      const char **out)
> +static inline bool skip_prefix(const char *str, const char *prefix,
> +			       const char **out)
>   {
>   	do {
>   		if (!*prefix) {
>   			*out = str;
> -			return 1;
> +			return true;
>   		}
>   	} while (*str++ == *prefix++);
> -	return 0;
> +	return false;
>   }
> 
>   /*
>    * Like skip_prefix, but promises never to read past "len" bytes of the input
>    * buffer, and returns the remaining number of bytes in "out" via "outlen".
>    */
> -static inline int skip_prefix_mem(const char *buf, size_t len,
> -				  const char *prefix,
> -				  const char **out, size_t *outlen)
> +static inline bool skip_prefix_mem(const char *buf, size_t len,
> +				   const char *prefix,
> +				   const char **out, size_t *outlen)
>   {
>   	size_t prefix_len = strlen(prefix);
>   	if (prefix_len <= len && !memcmp(buf, prefix, prefix_len)) {
>   		*out = buf + prefix_len;
>   		*outlen = len - prefix_len;
> -		return 1;
> +		return true;
>   	}
> -	return 0;
> +	return false;
>   }
> 
>   /*
> - * If buf ends with suffix, return 1 and subtract the length of the suffix
> - * from *len. Otherwise, return 0 and leave *len untouched.
> + * If buf ends with suffix, return true and subtract the length of the suffix
> + * from *len. Otherwise, return false and leave *len untouched.
>    */
> -static inline int strip_suffix_mem(const char *buf, size_t *len,
> -				   const char *suffix)
> +static inline bool strip_suffix_mem(const char *buf, size_t *len,
> +				    const char *suffix)
>   {
>   	size_t suflen = strlen(suffix);
>   	if (*len < suflen || memcmp(buf + (*len - suflen), suffix, suflen))
> -		return 0;
> +		return false;
>   	*len -= suflen;
> -	return 1;
> +	return true;
>   }
> 
>   /*
> - * If str ends with suffix, return 1 and set *len to the size of the string
> - * without the suffix. Otherwise, return 0 and set *len to the size of the
> + * If str ends with suffix, return true and set *len to the size of the string
> + * without the suffix. Otherwise, return false and set *len to the size of the
>    * string.
>    *
>    * Note that we do _not_ NUL-terminate str to the new length.
>    */
> -static inline int strip_suffix(const char *str, const char *suffix, size_t *len)
> +static inline bool strip_suffix(const char *str, const char *suffix,
> +				size_t *len)
>   {
>   	*len = strlen(str);
>   	return strip_suffix_mem(str, len, suffix);
> --
> 2.43.0
> 

^ permalink raw reply

* Re: [PATCH] Use ^=1 to toggle between 0 and 1
From: Phillip Wood @ 2023-12-18 16:18 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Jeff King, René Scharfe, AtariDreams via GitGitGadget, git,
	Seija Kijin
In-Reply-To: <xmqqo7erl7er.fsf@gitster.g>

Hi Junio

On 15/12/2023 17:09, Junio C Hamano wrote:
> Phillip Wood <phillip.wood123@gmail.com> writes:
> 
>> Even if it unlikely that we would directly compare a boolean variable
>> to "true" or "false" it is certainly conceivable that we'd compare two
>> boolean variables directly. For the integer fallback to be safe we'd
>> need to write
>>
>> 	if (!cond_a == !cond_b)
>>
>> rather than
>>
>> 	if (cond_a == cond_b)
> 
> Eek, it defeats the benefit of using true Boolean type if we had to
> train ourselves to write the former, doesn't it?

Yes, it's horrible - if for some reason it turns out that we cannot use 
"#include <stdbool.h>" everywhere I think we should drop it rather than 
providing a subtly incompatible fallback

>> A weather-balloon seems like the safest route forward. We have been
>> requiring C99 for two years now [1], hopefully there aren't any
>> compilers out that claim to support C99 but don't provide
>> "<stdbool.h>" (I did check online and the compiler on NonStop does
>> support _Bool).
>>
>> Best Wishes
>>
>> Phillip
>>
>> [1] 7bc341e21b (git-compat-util: add a test balloon for C99 support,
>> 2021-12-01)
> 
> Nice to be reminded of this one.
> 
> The cited commit does not start to use any specific feature from
> C99, other than that we now require that the compiler claims C99
> conformance by __STDC_VERSION__ set appropriately.  The commit log
> message says C99 "provides a variety of useful features, including
> ..., many of which we already use.", which implies that our wish was
> to officially allow any and all features in C99 to be used in our
> codebase after a successful flight of this test balloon.
> 
> Now, I think we saw a successful flight of this test balloon by now.
> Is allowing all the C99 the next step we really want to take?
 >
> I still personally have an aversion against decl-after-statement and
> //-comments, not due to portability reasons at all, but because I
> find that the code is easier to read without it. But in principle,
> it is powerful to be able to say "OK, as long as the feature is in
> C99 you can use it", instead of having to decide on individual
> features, and I am not fundamentally against going that route if it
> is where people want to go.

I'm not sure we necessarily want to say "use anything that is in C99" 
for several reasons.

  - Some features such as C99's variable length arrays are known to be
    problematic.

  - As you say above there maybe features that we think harm the
    readability of our code.

  - As René points out not all compilers necessarily support all
    features.

I think using _Bool could be useful for the reasons Peff outlined. As 
for other features I've written code that I think would have benefited 
from compound literals, but off the top of my head I can't think of any 
other C99 features that I personally wish we were using. I think that 
decl-after-statement is occasionally useful to declare a variable near 
where it is used in a long function body but it is much simpler just to 
ban it altogether and encourage people to break up long functions to 
make them more readable.

Best Wishes

Phillip

> Thanks.
> 
> 

^ permalink raw reply

* Re: [PATCH] doc: format.notes specify a ref under refs/notes/ hierarchy
From: Junio C Hamano @ 2023-12-18 16:16 UTC (permalink / raw)
  To: Patrick Steinhardt, Jiang Xin; +Cc: git, Ramsay Jones
In-Reply-To: <ZX_9nRYKVq0jT0Lp@tanuki>

Patrick Steinhardt <ps@pks.im> writes:

> On Fri, Dec 15, 2023 at 02:28:00PM -0800, Junio C Hamano wrote:
>> There is no 'ref/notes/' hierarchy.  '[format] notes = foo' uses notes
>> that are found in 'refs/notes/foo'.
>> 
>> Signed-off-by: Junio C Hamano <gitster@pobox.com>
>> ---
>>  * According to my eyeballing "git grep refs/ Documentation" result,
>>    this was the only remaining mention of "ref/" in Documentation/
>>    hierarchy that misspells "refs/".
>
> This made me look for additional instances where we were referring to
> "ref/". Turns out it's only a very limited set, see the below diff.

Yup, I did the same grep, but I tend to avoid churning what we
published long ago (and kept in Documentation/RelNotes/), my patches
only covered documents that are still relevant.

> the translation changes with a big grain of salt though,

Hopefully pinging Jiang would be sufficient to ask help from the
French, Chinese, and Taiwaneese translation teams.

> diff --git a/po/fr.po b/po/fr.po
> index ee2e610ef1..744550b056 100644
> --- a/po/fr.po
> +++ b/po/fr.po
> @@ -19773,7 +19773,7 @@ msgid ""
>  "Neither worked, so we gave up. You must fully qualify the ref."
>  msgstr ""
>  "La destination que vous avez fournie n'est pas un nom de référence complète\n"
> -"(c'est-à-dire commençant par \"ref/\"). Essai d'approximation par :\n"
> +"(c'est-à-dire commençant par \"refs/\"). Essai d'approximation par :\n"
>  "\n"
>  "- Recherche d'une référence qui correspond à '%s' sur le serveur distant.\n"
>  "- Vérification si la <source> en cours de poussée ('%s')\n"
> diff --git a/po/zh_CN.po b/po/zh_CN.po
> index 86402725b2..eb47e8f9b7 100644
> --- a/po/zh_CN.po
> +++ b/po/zh_CN.po
> @@ -13224,8 +13224,8 @@ msgid ""
>  msgid_plural ""
>  "Note: Some branches outside the refs/remotes/ hierarchy were not removed;\n"
>  "to delete them, use:"
> -msgstr[0] "注意:ref/remotes 层级之外的一个分支未被移除。要删除它,使用:"
> -msgstr[1] "注意:ref/remotes 层级之外的一些分支未被移除。要删除它们,使用:"
> +msgstr[0] "注意:refs/remotes 层级之外的一个分支未被移除。要删除它,使用:"
> +msgstr[1] "注意:refs/remotes 层级之外的一些分支未被移除。要删除它们,使用:"
>  
>  #: builtin/remote.c
>  #, c-format
> diff --git a/po/zh_TW.po b/po/zh_TW.po
> index f777a0596f..b2a79cdd93 100644
> --- a/po/zh_TW.po
> +++ b/po/zh_TW.po
> @@ -13109,7 +13109,7 @@ msgid ""
>  msgid_plural ""
>  "Note: Some branches outside the refs/remotes/ hierarchy were not removed;\n"
>  "to delete them, use:"
> -msgstr[0] "注意:ref/remotes 層級之外的一個分支未被移除。要刪除它,使用:"
> +msgstr[0] "注意:refs/remotes 層級之外的一個分支未被移除。要刪除它,使用:"
>  
>  #: builtin/remote.c
>  #, c-format

> Also, the test is
> interesting because it would fail even if we didn't pass an invalid atom
> to git-for-each-ref(1).

It is interesting but not surprising.  It is not an error to use ref
patterns that do not match any ref.  It is a mere pattern to filtering
what are in refs/ for the ones to be output.

> diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
> index 54e2281259..e68f7bec8e 100755
> --- a/t/t6300-for-each-ref.sh
> +++ b/t/t6300-for-each-ref.sh
> @@ -841,7 +841,7 @@ test_expect_success 'err on bad describe atom arg' '
>  		EOF
>  		test_must_fail git for-each-ref \
>  			--format="%(describe:tags,qux=1,abbrev=14)" \
> -			ref/heads/master 2>actual &&
> +			refs/heads/master 2>actual &&
>  		test_cmp expect actual
>  	)
>  '

The "for-each-ref" family's "--format" string is first parsed and
sanity-checked before it is applied.  The bogus ref pattern may not
yield any ref to apply the format string, but we do not optimize out
the parsing and checking, even though we could, as it would be
optimizing for a wrong case.  So regardless of the ref pattern at
the end of the command line does not make a difference to the
outcome of this test.

^ permalink raw reply

* [PATCH] rebase-interactive: show revert option and add single letter shortcut
From: Michael Lohmann @ 2023-12-18 15:23 UTC (permalink / raw)
  To: git; +Cc: Michael Lohmann, Johannes Schindelin
In-Reply-To: <3e71666c-22a0-f52b-4025-dddb096e7e6c@gmx.de>

Signed-off-by: Michael Lohmann <mi.al.lohmann@gmail.com>
---
 Documentation/git-rebase.txt | 3 +++
 rebase-interactive.c         | 1 +
 sequencer.c                  | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 1dd6555f66..75f6fe39a1 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -911,6 +911,9 @@ commit, the message from the final one is used.  You can also use
 "fixup -C" to get the same behavior as "fixup -c" except without opening
 an editor.
 
+To revert a commit, add a line starting with "revert" followed by the commit
+name.
+
 `git rebase` will stop when "pick" has been replaced with "edit" or
 when a command fails due to merge errors. When you are done editing
 and/or resolving conflicts you can continue with `git rebase --continue`.
diff --git a/rebase-interactive.c b/rebase-interactive.c
index d9718409b3..e1fd1e09e3 100644
--- a/rebase-interactive.c
+++ b/rebase-interactive.c
@@ -53,6 +53,7 @@ void append_todo_help(int command_count,
 "                   commit's log message, unless -C is used, in which case\n"
 "                   keep only this commit's message; -c is same as -C but\n"
 "                   opens the editor\n"
+"v, revert <commit> = revert the changes introduced by that commit\n"
 "x, exec <command> = run command (the rest of the line) using shell\n"
 "b, break = stop here (continue rebase later with 'git rebase --continue')\n"
 "d, drop <commit> = remove commit\n"
diff --git a/sequencer.c b/sequencer.c
index d584cac8ed..3c18f71ed6 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1767,7 +1767,7 @@ static struct {
 	const char *str;
 } todo_command_info[] = {
 	[TODO_PICK] = { 'p', "pick" },
-	[TODO_REVERT] = { 0,   "revert" },
+	[TODO_REVERT] = { 'v', "revert" },
 	[TODO_EDIT] = { 'e', "edit" },
 	[TODO_REWORD] = { 'r', "reword" },
 	[TODO_FIXUP] = { 'f', "fixup" },
-- 
2.43.0.77.g0ff82d959c


^ permalink raw reply related

* [PATCH] Teach git apply to respect core.fileMode settings
From: Chandra Pratap via GitGitGadget @ 2023-12-18 14:09 UTC (permalink / raw)
  To: git; +Cc: Chandra Pratap, Chandra Pratap

From: Chandra Pratap <chandrapratap3519@gmail.com>

CC: Johannes Schindelin <johannes.schindelin@gmail.com>
Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
---
    apply: make git apply respect core.fileMode settings
    
    When applying a patch that adds an executable file, git apply ignores
    the core.fileMode setting (core.fileMode in git config specifies whether
    the executable bit on files in the working tree
    should be honored or not) resulting in warnings like:
    
    warning: script.sh has type 100644, expected 100755
    
    even when core.fileMode is set to false, which is undesired. This is
    extra true for systems like Windows which don't rely on lsat().
    
    Fix this by inferring the correct file mode from the existing index
    entry when core.filemode is set to false. The added test case helps
    verify the change and prevents future regression.
    
    Reviewed-by: Johannes Schindelin johannes.schindelin@gmail.com
    Signed-off-by: Chandra Pratap chandrapratap3519@gmail.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1620%2FChand-ra%2Fdevel-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1620/Chand-ra/devel-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1620

 apply.c                   |  7 +++++--
 t/t4129-apply-samemode.sh | 15 +++++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/apply.c b/apply.c
index 3d69fec836d..56790f515e0 100644
--- a/apply.c
+++ b/apply.c
@@ -3778,8 +3778,11 @@ static int check_preimage(struct apply_state *state,
 		return error_errno("%s", old_name);
 	}
 
-	if (!state->cached && !previous)
-		st_mode = ce_mode_from_stat(*ce, st->st_mode);
+	if (!state->cached && !previous) {
+		if (!trust_executable_bit && patch->old_mode)
+			st_mode = patch->old_mode;
+		else st_mode = ce_mode_from_stat(*ce, st->st_mode);
+	}
 
 	if (patch->is_new < 0)
 		patch->is_new = 0;
diff --git a/t/t4129-apply-samemode.sh b/t/t4129-apply-samemode.sh
index e7a7295f1b6..95917fee128 100755
--- a/t/t4129-apply-samemode.sh
+++ b/t/t4129-apply-samemode.sh
@@ -101,4 +101,19 @@ test_expect_success POSIXPERM 'do not use core.sharedRepository for working tree
 	)
 '
 
+test_expect_success FILEMODE 'ensure git apply respects core.fileMode' '
+	test_config core.fileMode false &&
+	echo true >script.sh &&
+	git add --chmod=+x script.sh &&
+	test_tick && git commit -m "Add script" &&
+
+	echo true >>script.sh &&
+	test_tick && git commit -m "Modify script" script.sh &&
+	git format-patch -1 --stdout >patch &&
+
+	git switch -c branch HEAD^ &&
+	git apply patch 2>err &&
+	! test_grep "has type 100644, expected 100755" err
+'
+
 test_done

base-commit: 1a87c842ece327d03d08096395969aca5e0a6996
-- 
gitgitgadget

^ permalink raw reply related

* Subtitles for git scm documentation video
From: 김민지 @ 2023-12-18 13:12 UTC (permalink / raw)
  To: git

Hello, I am a college student attending Ajou University in South Korea.
My major is Cyber Security, and I recently discovered this site
(https://git-scm.com/doc) while studying open-source software,
including git.
While watching the video posted here, I found that there were no
Korean subtitles.
I'd like to work on adding Korean subtitles to the four videos posted
here so that other Koreans can study more easily, is it possible?
And if it is possible, I would really appreciate it if you could let
me know how to work on it.
Have a great day. Minji

^ permalink raw reply

* [PATCH 1/1] revert/cherry-pick: add --show-current-patch option
From: Michael Lohmann @ 2023-12-18 12:10 UTC (permalink / raw)
  To: git; +Cc: Michael Lohmann, Elijah Newren
In-Reply-To: <20231218121048.68290-1-mi.al.lohmann@gmail.com>

This aligns the interface to the rebase one and allows for an easier way
of figuring out how to resolve conflicts if commits fail to apply
(especially when reverting/cherry-picking multiple commits at the same
time)

Signed-off-by: Michael Lohmann <mi.al.lohmann@gmail.com>
---
 Documentation/git-cherry-pick.txt      |  2 +-
 Documentation/git-revert.txt           |  2 +-
 Documentation/sequencer.txt            |  5 +++++
 builtin/rebase.c                       |  7 ++----
 builtin/revert.c                       |  9 ++++++--
 contrib/completion/git-completion.bash |  2 +-
 sequencer.c                            | 24 +++++++++++++++++++++
 sequencer.h                            |  2 ++
 t/t3507-cherry-pick-conflict.sh        | 30 ++++++++++++++++++++++++++
 9 files changed, 73 insertions(+), 10 deletions(-)

diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt
index fdcad3d200..af41903fe7 100644
--- a/Documentation/git-cherry-pick.txt
+++ b/Documentation/git-cherry-pick.txt
@@ -10,7 +10,7 @@ SYNOPSIS
 [verse]
 'git cherry-pick' [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff]
 		  [-S[<keyid>]] <commit>...
-'git cherry-pick' (--continue | --skip | --abort | --quit)
+'git cherry-pick' (--continue | --skip | --abort | --quit | --show-current-patch)
 
 DESCRIPTION
 -----------
diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt
index cbe0208834..5bd2ecf35a 100644
--- a/Documentation/git-revert.txt
+++ b/Documentation/git-revert.txt
@@ -9,7 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'git revert' [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] <commit>...
-'git revert' (--continue | --skip | --abort | --quit)
+'git revert' (--continue | --skip | --abort | --quit | --show-current-patch)
 
 DESCRIPTION
 -----------
diff --git a/Documentation/sequencer.txt b/Documentation/sequencer.txt
index 3bceb56474..e9394761bc 100644
--- a/Documentation/sequencer.txt
+++ b/Documentation/sequencer.txt
@@ -12,5 +12,10 @@
 	to clear the sequencer state after a failed cherry-pick or
 	revert.
 
+--show-current-patch::
+	Show the current patch when a revert or cherry-pick is
+	stopped because of conflicts. This is the equivalent of
+	`git show REVERT_HEAD` or `git show CHERRY_PICK_HEAD`.
+
 --abort::
 	Cancel the operation and return to the pre-sequence state.
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 9f8192e0a5..8ad3cf3e90 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -360,12 +360,9 @@ static int run_sequencer_rebase(struct rebase_options *opts)
 		ret = edit_todo_file(flags);
 		break;
 	case ACTION_SHOW_CURRENT_PATCH: {
-		struct child_process cmd = CHILD_PROCESS_INIT;
-
-		cmd.git_cmd = 1;
-		strvec_pushl(&cmd.args, "show", "REBASE_HEAD", "--", NULL);
-		ret = run_command(&cmd);
+		struct replay_opts replay_opts = get_replay_opts(opts);
 
+		ret = sequencer_show_current_patch(the_repository, &replay_opts);
 		break;
 	}
 	default:
diff --git a/builtin/revert.c b/builtin/revert.c
index e6f9a1ad26..cbcd9fdc23 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -24,14 +24,14 @@
 
 static const char * const revert_usage[] = {
 	N_("git revert [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] <commit>..."),
-	N_("git revert (--continue | --skip | --abort | --quit)"),
+	N_("git revert (--continue | --skip | --abort | --quit | --show-current-patch)"),
 	NULL
 };
 
 static const char * const cherry_pick_usage[] = {
 	N_("git cherry-pick [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff]\n"
 	   "                [-S[<keyid>]] <commit>..."),
-	N_("git cherry-pick (--continue | --skip | --abort | --quit)"),
+	N_("git cherry-pick (--continue | --skip | --abort | --quit | --show-current-patch)"),
 	NULL
 };
 
@@ -93,6 +93,7 @@ static int run_sequencer(int argc, const char **argv, const char *prefix,
 		OPT_CMDMODE(0, "continue", &cmd, N_("resume revert or cherry-pick sequence"), 'c'),
 		OPT_CMDMODE(0, "abort", &cmd, N_("cancel revert or cherry-pick sequence"), 'a'),
 		OPT_CMDMODE(0, "skip", &cmd, N_("skip current commit and continue"), 's'),
+		OPT_CMDMODE(0, "show-current-patch", &cmd, N_("show the patch file being reverted or cherry-picked"), 'p'),
 		OPT_CLEANUP(&cleanup_arg),
 		OPT_BOOL('n', "no-commit", &opts->no_commit, N_("don't automatically commit")),
 		OPT_BOOL('e', "edit", &opts->edit, N_("edit the commit message")),
@@ -154,6 +155,8 @@ static int run_sequencer(int argc, const char **argv, const char *prefix,
 			this_operation = "--continue";
 		else if (cmd == 's')
 			this_operation = "--skip";
+		else if (cmd == 'p')
+			this_operation = "--show-current-patch";
 		else {
 			assert(cmd == 'a');
 			this_operation = "--abort";
@@ -224,6 +227,8 @@ static int run_sequencer(int argc, const char **argv, const char *prefix,
 		return sequencer_rollback(the_repository, opts);
 	if (cmd == 's')
 		return sequencer_skip(the_repository, opts);
+	if (cmd == 'p')
+		return sequencer_show_current_patch(the_repository, opts);
 	return sequencer_pick_revisions(the_repository, opts);
 }
 
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 13a39ebd2e..b740b7d48c 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1618,7 +1618,7 @@ _git_checkout ()
 	esac
 }
 
-__git_sequencer_inprogress_options="--continue --quit --abort --skip"
+__git_sequencer_inprogress_options="--continue --quit --abort --skip --show-current-patch"
 
 __git_cherry_pick_inprogress_options=$__git_sequencer_inprogress_options
 
diff --git a/sequencer.c b/sequencer.c
index d584cac8ed..3f6f9ad75c 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3417,6 +3417,30 @@ int sequencer_skip(struct repository *r, struct replay_opts *opts)
 	return -1;
 }
 
+int sequencer_show_current_patch(struct repository *r, struct replay_opts *opts)
+{
+	struct child_process cmd = CHILD_PROCESS_INIT;
+	cmd.git_cmd = 1;
+	switch (opts->action) {
+	case REPLAY_REVERT:
+		if (!refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD"))
+			die(_("No revert in progress?"));
+		strvec_pushl(&cmd.args, "show", "REVERT_HEAD", "--", NULL);
+		break;
+	case REPLAY_PICK:
+		if (!refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD"))
+			die(_("No cherry-pick in progress?"));
+		strvec_pushl(&cmd.args, "show", "CHERRY_PICK_HEAD", "--", NULL);
+		break;
+	case REPLAY_INTERACTIVE_REBASE:
+		if (!refs_ref_exists(get_main_ref_store(r), "REBASE_HEAD"))
+			die(_("No rebase in progress?"));
+		strvec_pushl(&cmd.args, "show", "REBASE_HEAD", "--", NULL);
+		break;
+	}
+	return run_command(&cmd);
+}
+
 static int save_todo(struct todo_list *todo_list, struct replay_opts *opts,
 		     int reschedule)
 {
diff --git a/sequencer.h b/sequencer.h
index 913a0f652d..e20cb8bc56 100644
--- a/sequencer.h
+++ b/sequencer.h
@@ -162,6 +162,8 @@ int sequencer_pick_revisions(struct repository *repo,
 			     struct replay_opts *opts);
 int sequencer_continue(struct repository *repo, struct replay_opts *opts);
 int sequencer_rollback(struct repository *repo, struct replay_opts *opts);
+int sequencer_show_current_patch(struct repository *repo,
+				 struct replay_opts *opts);
 int sequencer_skip(struct repository *repo, struct replay_opts *opts);
 void replay_opts_release(struct replay_opts *opts);
 int sequencer_remove_state(struct replay_opts *opts);
diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh
index c88d597b12..4f50d287a6 100755
--- a/t/t3507-cherry-pick-conflict.sh
+++ b/t/t3507-cherry-pick-conflict.sh
@@ -566,6 +566,36 @@ test_expect_success 'cherry-pick preserves sparse-checkout' '
 	test_grep ! "Changes not staged for commit:" actual
 '
 
+test_expect_success 'cherry-pick --show-current-patch fails if no cherry-pick in progress' '
+	pristine_detach initial &&
+	test_must_fail git cherry-pick --show-current-patch
+'
+
+test_expect_success 'cherry-pick --show-current-patch describes patch that failed to apply' '
+	test_when_finished "git cherry-pick --abort || :" &&
+	pristine_detach initial &&
+	git show picked >expected &&
+
+	test_must_fail git cherry-pick picked &&
+
+	git cherry-pick --show-current-patch >actual &&
+	test_cmp expected actual
+'
+
+test_expect_success 'revert --show-current-patch fails if no revert in progress' '
+	pristine_detach initial &&
+	test_must_fail git revert --show-current-patch
+'
+
+test_expect_success 'revert --show-current-patch describes patch that failed to apply' '
+	test_when_finished "git revert --abort || :" &&
+	pristine_detach initial &&
+	git show picked >expected &&
+	test_must_fail git revert picked &&
+	git revert --show-current-patch >actual &&
+	test_cmp expected actual
+'
+
 test_expect_success 'cherry-pick --continue remembers --keep-redundant-commits' '
 	test_when_finished "git cherry-pick --abort || :" &&
 	pristine_detach initial &&
-- 
2.43.0.77.gff6ea8bb74


^ permalink raw reply related

* [PATCH 0/1] revert/cherry-pick: add --show-current-patch option
From: Michael Lohmann @ 2023-12-18 12:10 UTC (permalink / raw)
  To: git; +Cc: Michael Lohmann, Elijah Newren

Hi,
I am a lead developer of a small team and quite often I have to
cherry-pick commits (and sometimes also revert them). When
cherry-picking multiple commits at once and there is a merge conflict it
sometimes can be hard to understand what the current patch is trying to
do in order to resolve the conflict properly. With `rebase` there is
`--show-current-patch` and since that is quite helpful I would suggest
to also add this flag also to `cherry-pick` and `revert`.

Since this is my first contribution to git I am not exactly sure where
the best place for this functionality is. From my initial understanding
there are two places where to put the actual invocation of the `show`:
- Duplicate the code (with the needed adaptations) of builtin/rebase.c
  in builtin/revert.c
- Create a central function that shows the respective `*_HEAD` depending
  on the current `action`.

In this first draft I went with the second option, since I felt that it
reduces code duplication and the sequencer already has the action enum
with exactly those three cases. On the other hand I don’t really have a
good understanding of the role that this `sequencer` should play and if
this adds additional coupling that is unwanted. My current impression
is, that this would be the right place, since this looks to be the core
of the commands where a user can apply a sequence of commits and in my
opinion even if additional actions would be added, they could also fail
and so it would be good to add the `--show-current-patch` option to that
one as well.

Side note: my only C(++) experience was ~10 years ago and only for a
single university course, so my perspective is much more from a general
architecture point of view than based on any C experience, let alone in
this code base and so I would be very grateful for criticism!


Side note: The check for the `REBASE_HEAD` would not be necessary, since
that is already taken care of in the builtin/rebase.c before.
Nevertheless I opted for this check, because I would much rather require
the same preconditions no matter from where I call this function. The
whole argument parsing / option struct are very different between rebase
and revert. Maybe it would make sense to align them a bit further?
Initial observations: `rebase_options->type` is functionally similar to
`replay_opts->action` (as in "what general action am I performing? -
interactive rebase / cherry-pick / revert / ...") whereas
`rebase_options->action` is not part of the `replay_opts` struct at all.
Instead the role is taken over in builtin/revert.c by `int cmd = 0;`.
I am preparing a patch converting this to an enum, so that there are
no random chars that have to be kept in sync manually in different
places, or is that a design decision?

I looked through the mailing list archive and did not find anything
related on this topic. The only slightly related thread I could find was
in [1] by Elijah Newren and that one was talking about a separate
possible feature and how to get certain information if CHERRY_PICK_HEAD
and REVERT_HEAD were to be replaced by a different construct. I hope I
did not miss something...

Cheers
Michael

[1]:
https://lore.kernel.org/git/CABPp-BGd-W8T7EsvKYyjdi3=mfSTJ8zM-uzVsFnh1AWyV2wEzQ@mail.gmail.com

Michael Lohmann (1):
  revert/cherry-pick: add --show-current-patch option

 Documentation/git-cherry-pick.txt      |  2 +-
 Documentation/git-revert.txt           |  2 +-
 Documentation/sequencer.txt            |  5 +++++
 builtin/rebase.c                       |  7 ++----
 builtin/revert.c                       |  9 ++++++--
 contrib/completion/git-completion.bash |  2 +-
 sequencer.c                            | 24 +++++++++++++++++++++
 sequencer.h                            |  2 ++
 t/t3507-cherry-pick-conflict.sh        | 30 ++++++++++++++++++++++++++
 9 files changed, 73 insertions(+), 10 deletions(-)

-- 
2.43.0.77.gff6ea8bb74


^ permalink raw reply

* Re: Question regarding Git updater
From: Johannes Schindelin @ 2023-12-18 11:21 UTC (permalink / raw)
  To: Andreas Scholz; +Cc: git
In-Reply-To: <CAHDWvZyHDbjOnnCYCkfMY+HPWobrcgP6c1kkWFrRgWV4fHED=w@mail.gmail.com>

Hi Andreas,

On Thu, 14 Dec 2023, Andreas Scholz wrote:

> I hope you can help me with answering my question regarding the update
> mechanism for Git after it has been installed.

Assuming that you mean Git for Windows and its updater that you can enable
by checking the "Check daily for Git for Windows updates" option on the
Components page, I will provide answers below (if you are not talking
about Git for Windows, I apologize, and ask for clarification):

> 1) Does the updater autonomously figure out if there is a newer
> version than the current one that is installed?

Git for Windows' updater is backed by a Unix shell script:
https://github.com/git-for-windows/build-extra/blob/HEAD/git-extra/git-update-git-for-windows

When configured to run regularly via a scheduled task, it will be called
with the options `--quiet --gui`. It starts by determining the latest tag:
https://github.com/git-for-windows/build-extra/blob/15b05c2399f152783d1fe9f167692dd5cd8ae1e1/git-extra/git-update-git-for-windows#L222
which downloads https://gitforwindows.org/latest-tag.txt, a file that is
hosted on GitHub Pages and that is updated as part of every Git for
Windows release.

The script then continues by determining the local version:
https://github.com/git-for-windows/build-extra/blob/15b05c2399f152783d1fe9f167692dd5cd8ae1e1/git-extra/git-update-git-for-windows#L248
and comparing both versions:
https://github.com/git-for-windows/build-extra/blob/15b05c2399f152783d1fe9f167692dd5cd8ae1e1/git-extra/git-update-git-for-windows#L257-L262
exiting with success if they match.

Most notably, it does _not_ verify that the remote version is newer,
meaning: If you build and install a custom Git version that reports a
version number, say, 100.100.100, the updater will still propose to update
from that, even if the current version is v2.43.0.

> 2) Or does the updater only ask, when the user actively uses a command
> to ask Git to check for a newer version?

Users are welcome to run `git update-git-for-windows` manually. If
aforementioned checkbox was checked during installation, this won't be
necessary, strictly speaking.

> 3) In both cases, what information about the user/system is sent with
> the request? Is this information stored on a server or database etc.?

The information that is sent is the IP address and the HTTP headers sent
by `curl` in
https://github.com/git-for-windows/build-extra/blob/15b05c2399f152783d1fe9f167692dd5cd8ae1e1/git-extra/git-update-git-for-windows#L120-L125
i.e. a User-Agent (`curl` does not seem to include the current OS there),
but not the current Git for Windows version (an information that, if
available, would actually help me perform my role of Git for Windows
maintainer a lot better). Since the request goes to GitHub Pages, which
does not store any information, all of that information vanishes right
after the HTTP response is sent.

Ciao,
Johannes

^ permalink raw reply

* Re: Why is `revert` undocumented in interactive rebase todo help?
From: Johannes Schindelin @ 2023-12-18 10:53 UTC (permalink / raw)
  To: Michael Lohmann; +Cc: git, Michael Lohmann
In-Reply-To: <20231218065313.55725-1-mi.al.lohmann@gmail.com>

Hi Michael,

On Mon, 18 Dec 2023, Michael Lohmann wrote:

> I wanted to align rebase and revert/cherry-pick a bit more (for the
> latter I am currently finishing my patch for --show-current-patch and
> then looked into possibly implementing --edit-todo). To avoid code
> duplication I wanted to reuse the existing interactive-rebase code as
> much as possible and ended up at the todo script parsing in the
> sequencer. I was a bit surprised to find that the file could already
> handle the command `revert`, even though it isn't documented in
> `append_todo_help` of rebase-interactive.c - is that by choice or just
> missing documentation?

The reason that it is not documented, and that it has no single-letter
"short command", is that it is more of a historic accident than design
that interactive rebases support the "revert" command: In 004fefa754a4
(sequencer: completely revamp the "todo" script parsing, 2016-10-21), I
revamped sequencer's parsing of the "todo script", in preparation for
teaching it the trick to parse full-blown todo scripts of interactive
rebases in addition to parsing the (hitherto quite limited) `cherry-pick`
and `revert` "scripts", a trick that was completed with cca3be6ea15b
(Merge branch 'js/prepare-sequencer', 2016-10-27). These days, `git rebase
--interactive` uses that code to parse todo scripts.

Naturally, to be able to continue parsing the "revert scripts", the
`revert` command needed to be supported, and I never thought of disabling
it specifically for interactive rebases.

> Whenever I wanted to achieve this I used `break` and then manually did
> the revert, which obviously works fine, but it is much nicer to put the
> command in the todo file... (Now that I think about it I could also have
> done it with `exec`, but that is also not the nicest solution :D ).


Right. I often find myself adding commands like this one:

	x git revert -n <reverse-fixup> && git commit --amend --no-edit

to amend a commit with a reversal of another commit, most prominently when
I squashed a fixup into another commit than I had originally intended and
now need to fix that.

> The only other command not mentioned is `noop` which is obviously not
> too useful apart from distinguishing an empty list and aborting, so I
> totally understand it missing.

Correct, that one is intentionally not described, for the reasons you
described.

> Yes - in contrast to all the other options it does not have a single
> char notation (and 'r' is obviously already taken und 'u' for undo as
> well or 't' for the last letter), but why not show it in the list
> without it? Or maybe add 'v' for "reVert"?

Sure ;-)

Ciao,
Johannes

^ permalink raw reply

* [PATCH] commit-graph: fix memory leak when not writing graph
From: Patrick Steinhardt @ 2023-12-18 10:02 UTC (permalink / raw)
  To: git; +Cc: Taylor Blau

[-- Attachment #1: Type: text/plain, Size: 1902 bytes --]

When `write_commit_graph()` bails out writing a split commit-graph early
then it may happen that we have already gathered the set of existing
commit-graph file names without yet determining the new merged set of
files. This can result in a memory leak though because we only clear the
preimage of files when we have collected the postimage.

Fix this issue by dropping the condition altogether so that we always
try to free both preimage and postimage filenames. As the context
structure is zero-initialized this simplification is safe to do.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 commit-graph.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/commit-graph.c b/commit-graph.c
index acac9bf6e1..afe0177ab2 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -2617,19 +2617,16 @@ int write_commit_graph(struct object_directory *odb,
 	oid_array_clear(&ctx->oids);
 	clear_topo_level_slab(&topo_levels);
 
-	if (ctx->commit_graph_filenames_after) {
-		for (i = 0; i < ctx->num_commit_graphs_after; i++) {
-			free(ctx->commit_graph_filenames_after[i]);
-			free(ctx->commit_graph_hash_after[i]);
-		}
-
-		for (i = 0; i < ctx->num_commit_graphs_before; i++)
-			free(ctx->commit_graph_filenames_before[i]);
+	for (i = 0; i < ctx->num_commit_graphs_before; i++)
+		free(ctx->commit_graph_filenames_before[i]);
+	free(ctx->commit_graph_filenames_before);
 
-		free(ctx->commit_graph_filenames_after);
-		free(ctx->commit_graph_filenames_before);
-		free(ctx->commit_graph_hash_after);
+	for (i = 0; i < ctx->num_commit_graphs_after; i++) {
+		free(ctx->commit_graph_filenames_after[i]);
+		free(ctx->commit_graph_hash_after[i]);
 	}
+	free(ctx->commit_graph_filenames_after);
+	free(ctx->commit_graph_hash_after);
 
 	free(ctx);
 

base-commit: 1a87c842ece327d03d08096395969aca5e0a6996
-- 
2.43.GIT


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related

* Re: [PATCH 0/5] make room for "special ref"
From: Patrick Steinhardt @ 2023-12-18  8:56 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <20231215203245.3622299-1-gitster@pobox.com>

[-- Attachment #1: Type: text/plain, Size: 1832 bytes --]

On Fri, Dec 15, 2023 at 12:32:40PM -0800, Junio C Hamano wrote:
> Patrick's reftable work is progressing nicely and wants to establish
> "special ref" as a phrase with some defined meaning that is somewhat
> different from a mere "pseudo ref".
> 
> A pseudo ref is merely a normal ref with a funny naming convention,
> i.e., being outside the refs/ hierarchy and has names with all
> uppercase letters (or an underscore).  But there truly are refs that
> are more than that.  For example, FETCH_HEAD currently stores not
> just a single object name, but can and is used to store multiple
> object names, each with annotations to record where they came from.
> There indeed may be a need to introduce a new term to refer to such
> "special refs".
> 
> Existing documentation, however, uses "special ref" to refer to
> pseudo refs without any "special" property, like FETCH_HEAD does.
> 
> This series merely corrects such existing uses of the word, to make
> room for Patrick's series to introduce (and formally define in the
> glossary) "special refs".

Thanks for helping out with this effort and kicking off the discussion,
I highly appreciate it!

Patrick

> Junio C Hamano (5):
>   git.txt: HEAD is not that special
>   git-bisect.txt: BISECT_HEAD is not that special
>   refs.h: HEAD is not that special
>   docs: AUTO_MERGE is not that special
>   docs: MERGE_AUTOSTASH is not that special
> 
>  Documentation/git-bisect.txt    | 2 +-
>  Documentation/git-diff.txt      | 2 +-
>  Documentation/git-merge.txt     | 2 +-
>  Documentation/git.txt           | 7 ++++---
>  Documentation/merge-options.txt | 2 +-
>  Documentation/user-manual.txt   | 2 +-
>  refs.h                          | 2 +-
>  7 files changed, 10 insertions(+), 9 deletions(-)
> 
> -- 
> 2.43.0-76-g1a87c842ec
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH 1/5] git.txt: HEAD is not that special
From: Patrick Steinhardt @ 2023-12-18  8:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <20231215203245.3622299-2-gitster@pobox.com>

[-- Attachment #1: Type: text/plain, Size: 2364 bytes --]

On Fri, Dec 15, 2023 at 12:32:41PM -0800, Junio C Hamano wrote:
> The introductory text in "git help git" that describes HEAD called
> it "a special ref".  It is special compared to the more regular refs
> like refs/heads/master and refs/tags/v1.0.0, but not that special,
> unlike truly special ones like FETCH_HEAD.
> 
> Rewrite a few sentences to also introduce the distinction between a
> regular ref that contain the object name and a symbolic ref that
> contain the name of another ref.  Update the description of HEAD
> that point at the current branch to use the more correct term, a
> "symbolic ref".
> 
> This was found as part of auditing the documentation and in-code
> comments for uses of "special ref" that refer merely a "pseudo ref".
> 
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>  Documentation/git.txt | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/git.txt b/Documentation/git.txt
> index 2535a30194..880cdc5d7f 100644
> --- a/Documentation/git.txt
> +++ b/Documentation/git.txt
> @@ -1025,10 +1025,11 @@ When first created, objects are stored in individual files, but for
>  efficiency may later be compressed together into "pack files".
>  
>  Named pointers called refs mark interesting points in history.  A ref
> -may contain the SHA-1 name of an object or the name of another ref.  Refs
> -with names beginning `ref/head/` contain the SHA-1 name of the most
> +may contain the SHA-1 name of an object or the name of another ref (the
> +latter is called a "symbolic ref").

On a tangent: While we have a name for symbolic refs, do we also have a
name for non-symbolic refs? I often use the term "direct ref" to clearly
distinguish them from symbolic refs, but it's of course not defined in
our glossary.

> +Refs with names beginning `ref/head/` contain the SHA-1 name of the most
>  recent commit (or "head") of a branch under development.  SHA-1 names of
> -tags of interest are stored under `ref/tags/`.  A special ref named
> +tags of interest are stored under `ref/tags/`.  A symbolic ref named
>  `HEAD` contains the name of the currently checked-out branch.

I was briefly wondering whether we also want to replace SHA-1 with
"object hash" while at it, but it's certainly out of the scope of this
patch series.

Patrick

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH 0/5] make room for "special ref"
From: Patrick Steinhardt @ 2023-12-18  8:41 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Ramsay Jones, git, Andy Koppe
In-Reply-To: <xmqq7clfj7r4.fsf@gitster.g>

[-- Attachment #1: Type: text/plain, Size: 4024 bytes --]

On Fri, Dec 15, 2023 at 04:44:47PM -0800, Junio C Hamano wrote:
> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
> 
> > Yes, I was going to suggest exactly this, after Patrick pointed out
> > that there were only two 'special psuedo-refs' (I had a vague feeling
> > there were some more than that) FETCH_HEAD and MERGE_HEAD.

I don't think there are more special refs than those two. Andy pointed
out CHERRY_PICK_HEAD and REVERT_HEAD, but both of them actually get
accessed via the ref backend exclusively and thus cannot be special in
any way. Also, the test suite of Git passes with only those two refs
marked as special refs with the reftable backend, which is another good
indicator that I didn't miss anything here because we definitely can't
store special information in the reftable backend.

It's of course still possible that our test suite has a blind spot and
that I missed any special refs. If so, I would love to hear about them.

> Glad to see that I am not alone.  We should be able to treat
> MERGE_HEAD similarly.  It is used to communicate the list of "other
> parents" from "git merge" that stops in the middle (either for merge
> conflict, or in response to the "--no-commit" command line option)
> to "git commit" that concludes such an unfinished merge.  Many
> commands merely use the presence of MERGE_HEAD as a sign that a
> merge is in progress (e.g. "git status"), which would not break if
> we just started to record the first parent in a pseudoref MERGE_HEAD
> and wrote the other octopus parents elsewhere, but some commands do
> need all these parents from MERGE_HEAD (e.g. "git blame" that
> synthesizes a fake starting commit out of the working tree state).

I would certainly love to drop the "specialness" of both FETCH_HEAD and
MERGE_HEAD, but I am a bit pessimistic about whether we really can. The
format of those refs has been around for quite a long time already, and
I do expect that there is tooling out there that parses those files.

I would claim that it's especially likely that FETCH_HEAD is getting
parsed by external tools. Historically, there has not been a way to
really figure out which refs have been updated in git-fetch(1). So any
scripts that perform a fetch and want to learn about what was updated
would very likely resort to parsing FETCH_HEAD. This has changed a bit
with the introduction of the machine-parsable interface of git-fetch(1),
but it has only been introduced rather recently with Git v2.42.

> If we cannot get rid of all "special refs" anyway, however, I think
> there is little that we can gain from doing such "make FETCH_HEAD
> and MERGE_HEAD into a single-object pseudoref, and write other info
> in separate files" exercise.  We can treat the current FETCH_HEAD
> and MERGE_HEAD as "file that is not and is more than a ref", which
> is what the current code is doing anyway, which means we would
> declare that they have to stay to be files under $GIT_DIR/ and will
> be accessed via the filesystem access.

I'd like for it to be otherwise, but I think this is the only sensible
thing to do. I think it was a mistake to introduce those special refs
like this and treat them almost like a real ref, but that's always easy
to say in hindsight.

> At that point, calling them "special ref" might even be more
> misleading than its worth and we may be better off to admit that they
> are not even refs but a datafile some commands can use to obtain input
> from, but the phrase we use to refer to them, be it "special ref" or
> some random datafile, does not make a fundamental change on anything.

Well, the problem is that these do indeed behave like a ref for most of
the part: you can ask for them via git-rev-parse(1) and we'll resolve
them just fine, even though we only ever return the first object ID. So
even though I'm not a huge fan of calling them "special ref", I think we
should at least highlight the reflike-nature in whatever we want to call
them.

Patrick

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH 0/5] make room for "special ref"
From: Patrick Steinhardt @ 2023-12-18  8:24 UTC (permalink / raw)
  To: Andy Koppe; +Cc: Ramsay Jones, Junio C Hamano, git
In-Reply-To: <132a3daf-23fa-4575-a77f-bdf0a96fb5d8@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1323 bytes --]

On Sat, Dec 16, 2023 at 10:20:09AM +0000, Andy Koppe wrote:
> On 15/12/2023 22:44, Ramsay Jones wrote:
> > On 15/12/2023 21:21, Junio C Hamano wrote:
> 
> > > If somebody is reading FETCH_HEAD and acting on its contents (rather
> > > than merely consuming it as a ref of the first object), perhaps
> > > feeding it to "git fmt-merge-msg", they will be broken by such a
> > > change (indeed, our own "git pull" will be broken by the change to
> > > "git fetch", and the second bullet point above is about fixing the
> > > exact fallout from it), but I am not sure if that is a use case worth
> > > worrying about.
> > 
> > Yes, I was going to suggest exactly this, after Patrick pointed out
> > that there were only two 'special psuedo-refs' (I had a vague feeling
> > there were some more than that) FETCH_HEAD and MERGE_HEAD.
> 
> According to the pseudoref entry of gitglossary, CHERRY_PICK_HEAD also
> stores additional data (which would imply that REVERT_HEAD does too).
> Looking at CHERRY_PICK_HEAD during a pick though, I only see a single hash,
> even when picking multiple commits.

Both CHERRY_PICK_HEAD and REVERT_HEAD are only ever updated via the refs
API, so neither of them ever contains anything other than a normal ref.
I guess we should update the glossary accordingly.

Patrick

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH v3 0/2] fix fetch atomic error message
From: Patrick Steinhardt @ 2023-12-18  8:14 UTC (permalink / raw)
  To: Jiang Xin; +Cc: Git List, Junio C Hamano, Jiang Xin
In-Reply-To: <cover.1702821462.git.zhiyou.jx@alibaba-inc.com>

[-- Attachment #1: Type: text/plain, Size: 242 bytes --]

On Sun, Dec 17, 2023 at 10:11:32PM +0800, Jiang Xin wrote:
> From: Jiang Xin <zhiyou.jx@alibaba-inc.com>
> 
> # Changes since v2:
> 
> Changed the patches with help from Patrick.
> 

Thanks, this version looks good to me!

Patrick

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH] doc: format.notes specify a ref under refs/notes/ hierarchy
From: Patrick Steinhardt @ 2023-12-18  8:06 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Ramsay Jones
In-Reply-To: <xmqqjzpfje33.fsf_-_@gitster.g>

[-- Attachment #1: Type: text/plain, Size: 4554 bytes --]

On Fri, Dec 15, 2023 at 02:28:00PM -0800, Junio C Hamano wrote:
> There is no 'ref/notes/' hierarchy.  '[format] notes = foo' uses notes
> that are found in 'refs/notes/foo'.
> 
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>  * According to my eyeballing "git grep refs/ Documentation" result,
>    this was the only remaining mention of "ref/" in Documentation/
>    hierarchy that misspells "refs/".

This made me look for additional instances where we were referring to
"ref/". Turns out it's only a very limited set, see the below diff. Take
the translation changes with a big grain of salt though, and neither am
I sure whether we want to fix up past release notes. Also, the test is
interesting because it would fail even if we didn't pass an invalid atom
to git-for-each-ref(1).

Anyway, the patch you have looks obviously correct to me. I would be
happy to turn the below diff into a proper patch, but also wouldn't mind
to let you roll them into your patch series. Please let me know your
preference.

Patrick

diff --git a/Documentation/RelNotes/2.1.1.txt b/Documentation/RelNotes/2.1.1.txt
index 830fc3cc6d..d46e142119 100644
--- a/Documentation/RelNotes/2.1.1.txt
+++ b/Documentation/RelNotes/2.1.1.txt
@@ -29,7 +29,7 @@ Git v2.1.1 Release Notes
  * "git add x" where x that used to be a directory has become a
    symbolic link to a directory misbehaved.
 
- * The prompt script checked $GIT_DIR/ref/stash file to see if there
+ * The prompt script checked $GIT_DIR/refs/stash file to see if there
    is a stash, which was a no-no.
 
  * "git checkout -m" did not switch to another branch while carrying
diff --git a/Documentation/RelNotes/2.2.0.txt b/Documentation/RelNotes/2.2.0.txt
index e98ecbcff6..806908ddb2 100644
--- a/Documentation/RelNotes/2.2.0.txt
+++ b/Documentation/RelNotes/2.2.0.txt
@@ -205,7 +205,7 @@ notes for details).
  * "git add x" where x used to be a directory and is now a
    symbolic link to a directory misbehaved.
 
- * The prompt script checked the $GIT_DIR/ref/stash file to see if there
+ * The prompt script checked the $GIT_DIR/refs/stash file to see if there
    is a stash, which was a no-no.
 
  * Pack-protocol documentation had a minor typo.
diff --git a/po/fr.po b/po/fr.po
index ee2e610ef1..744550b056 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -19773,7 +19773,7 @@ msgid ""
 "Neither worked, so we gave up. You must fully qualify the ref."
 msgstr ""
 "La destination que vous avez fournie n'est pas un nom de référence complète\n"
-"(c'est-à-dire commençant par \"ref/\"). Essai d'approximation par :\n"
+"(c'est-à-dire commençant par \"refs/\"). Essai d'approximation par :\n"
 "\n"
 "- Recherche d'une référence qui correspond à '%s' sur le serveur distant.\n"
 "- Vérification si la <source> en cours de poussée ('%s')\n"
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 86402725b2..eb47e8f9b7 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -13224,8 +13224,8 @@ msgid ""
 msgid_plural ""
 "Note: Some branches outside the refs/remotes/ hierarchy were not removed;\n"
 "to delete them, use:"
-msgstr[0] "注意:ref/remotes 层级之外的一个分支未被移除。要删除它,使用:"
-msgstr[1] "注意:ref/remotes 层级之外的一些分支未被移除。要删除它们,使用:"
+msgstr[0] "注意:refs/remotes 层级之外的一个分支未被移除。要删除它,使用:"
+msgstr[1] "注意:refs/remotes 层级之外的一些分支未被移除。要删除它们,使用:"
 
 #: builtin/remote.c
 #, c-format
diff --git a/po/zh_TW.po b/po/zh_TW.po
index f777a0596f..b2a79cdd93 100644
--- a/po/zh_TW.po
+++ b/po/zh_TW.po
@@ -13109,7 +13109,7 @@ msgid ""
 msgid_plural ""
 "Note: Some branches outside the refs/remotes/ hierarchy were not removed;\n"
 "to delete them, use:"
-msgstr[0] "注意:ref/remotes 層級之外的一個分支未被移除。要刪除它,使用:"
+msgstr[0] "注意:refs/remotes 層級之外的一個分支未被移除。要刪除它,使用:"
 
 #: builtin/remote.c
 #, c-format
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index 54e2281259..e68f7bec8e 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -841,7 +841,7 @@ test_expect_success 'err on bad describe atom arg' '
 		EOF
 		test_must_fail git for-each-ref \
 			--format="%(describe:tags,qux=1,abbrev=14)" \
-			ref/heads/master 2>actual &&
+			refs/heads/master 2>actual &&
 		test_cmp expect actual
 	)
 '


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related

* Why is `revert` undocumented in interactive rebase todo help?
From: Michael Lohmann @ 2023-12-18  6:53 UTC (permalink / raw)
  To: git; +Cc: Michael Lohmann, Johannes Schindelin

Hi!
I wanted to align rebase and revert/cherry-pick a bit more (for the
latter I am currently finishing my patch for --show-current-patch and
then looked into possibly implementing --edit-todo). To avoid code
duplication I wanted to reuse the existing interactive-rebase code as
much as possible and ended up at the todo script parsing in the
sequencer. I was a bit surprised to find that the file could already
handle the command `revert`, even though it isn't documented in
`append_todo_help` of rebase-interactive.c - is that by choice or just
missing documentation?

Whenever I wanted to achieve this I used `break` and then manually did
the revert, which obviously works fine, but it is much nicer to put the
command in the todo file... (Now that I think about it I could also have
done it with `exec`, but that is also not the nicest solution :D ). The
only other command not mentioned is `noop` which is obviously not too
useful apart from distinguishing an empty list and aborting, so I
totally understand it missing.

Yes - in contrast to all the other options it does not have a single
char notation (and 'r' is obviously already taken und 'u' for undo as
well or 't' for the last letter), but why not show it in the list
without it? Or maybe add 'v' for "reVert"?

Cheers
Michael

P.S.: @Johannes Schindelin I saw your work of making the todo files in
the sequencer more reusable and the many reworks/improvements, so I
added you in cc - I hope that was alright (otherwise I'll buy you a
Kölsch as an apology ;) )...

^ permalink raw reply

* Re: Unable to install git-2.43.0 from source on macOS Big Sur 11.7.10
From: Eric Sunshine @ 2023-12-18  1:02 UTC (permalink / raw)
  To: Jonathan Abrams; +Cc: git@vger.kernel.org
In-Reply-To: <IA1PR12MB604488A775E3390E9B7E56BEB891A@IA1PR12MB6044.namprd12.prod.outlook.com>

On Sun, Dec 17, 2023 at 5:54 PM Jonathan Abrams
<jonathansabrams@outlook.com> wrote:
> I am trying to install git-2.43.0 from source on macOS Big Sur 11.7.10.  I have Xcode 13.2.1 installed.  I have read https://github.com/git/git/blob/master/INSTALL.
>
> The command that will not complete successfully is sudo make all doc.  The Terminal output before the error is as follows.

What steps did you take to build the project? Did you simply use `make
all` alone, or did you run `configure` first? Generally speaking,
running `configure` should be unnecessary on most platforms.

> Undefined symbols for architecture x86_64:
>   "_libiconv", referenced from:
>       _precompose_utf8_readdir in libgit.a(precompose_utf8.o)
>       _reencode_string_iconv in libgit.a(utf8.o)

It looks like it's not linking against `libiconv`. Aside from
answering the above question (and reporting the contents of
"config.mak.autogen" if you did run `configure`), you can also run
make as:

    make V=1 all

to see the actual command it's running at the point of failure. If you
paste that command, then we can find out whether or not it's trying to
link against `libiconv`.

^ permalink raw reply

* Re: [PATCH v2] test-lib-functions.sh: fix test_grep fail message wording
From: Eric Sunshine @ 2023-12-18  0:51 UTC (permalink / raw)
  To: Shreyansh Paliwal; +Cc: git, five231003, gitster
In-Reply-To: <20231217153140.1831-1-shreyanshpaliwalcmsmn@gmail.com>

On Sun, Dec 17, 2023 at 10:32 AM Shreyansh Paliwal
<shreyanshpaliwalcmsmn@gmail.com> wrote:
> ping.

Junio was on vacation at the time[1] that this patch was submitted, so
it's quite possible that it simply got overlooked or he hasn't gotten
through the backlog of emails which accumulated while he was away. So,
pinging is indeed the correct thing to do, and the patch is obviously
an improvement, so hopefully it will be picked up soon.

[1]: https://lore.kernel.org/git/xmqq34wj4e55.fsf@gitster.g/

^ permalink raw reply

* Unable to install git-2.43.0 from source on macOS Big Sur 11.7.10
From: Jonathan Abrams @ 2023-12-17 22:54 UTC (permalink / raw)
  To: git@vger.kernel.org

Hello,

I am trying to install git-2.43.0 from source on macOS Big Sur 11.7.10.  I have Xcode 13.2.1 installed.  I have read https://github.com/git/git/blob/master/INSTALL.

The command that will not complete successfully is sudo make all doc.  The Terminal output before the error is as follows.
--
    AR libgit.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libgit.a(zlib-uncompress2.o) has no symbols
    CC xdiff/xdiffi.o
    CC xdiff/xemit.o
    CC xdiff/xhistogram.o
    CC xdiff/xmerge.o
    CC xdiff/xpatience.o
    CC xdiff/xprepare.o
    CC xdiff/xutils.o
    AR xdiff/lib.a
    CC reftable/basics.o
    CC reftable/error.o
    CC reftable/block.o
    CC reftable/blocksource.o
    CC reftable/iter.o
    CC reftable/publicbasics.o
    CC reftable/merged.o
    CC reftable/pq.o
    CC reftable/reader.o
    CC reftable/record.o
    CC reftable/refname.o
    CC reftable/generic.o
    CC reftable/stack.o
    CC reftable/tree.o
    CC reftable/writer.o
    AR reftable/libreftable.a
    LINK git-daemon
Undefined symbols for architecture x86_64:
  "_libiconv", referenced from:
      _precompose_utf8_readdir in libgit.a(precompose_utf8.o)
      _reencode_string_iconv in libgit.a(utf8.o)
  "_libiconv_close", referenced from:
      _precompose_string_if_needed in libgit.a(precompose_utf8.o)
      _precompose_utf8_closedir in libgit.a(precompose_utf8.o)
      _reencode_string_len in libgit.a(utf8.o)
  "_libiconv_open", referenced from:
      _precompose_string_if_needed in libgit.a(precompose_utf8.o)
      _precompose_utf8_opendir in libgit.a(precompose_utf8.o)
      _reencode_string_len in libgit.a(utf8.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [git-daemon] Error 1
--
Does anyone reading this know how to resolve this error?

Thank you,

Jonathan S. Abrams

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox