* Re: Incorrect pipe for git log graph when using --name-status option
From: Junio C Hamano @ 2017-02-13 19:25 UTC (permalink / raw)
To: hIpPy; +Cc: git
In-Reply-To: <CAM_JFCwYAKCWrHqCtcwid27V1HvhuSmp4QpbNpgyMzrzWUNYog@mail.gmail.com>
hIpPy <hippy2981@gmail.com> writes:
> The `git log` command with `graph` and pretty format works correctly
> as expected.
>
> $ git log --graph --pretty=format:'%h' -2
> * 714a14e
> * 87dce5f
>
>
> However, with `--name-status` option added, there is a pipe
> incorrectly placed after the commit hash (example below).
>
> $ git log --graph --pretty=format:'%h' -2 --name-status
> * 714a14e|
> | M README.md
Is it a --name-status, or is it your own custom format, that is
causing the above issue?
- What happens if you stop using --pretty=format:%h and replace it
with something like --oneline?
- What happens if you keep using --pretty=format:%h but replace
--name-status with something else, e.g. --raw or --stat?
^ permalink raw reply
* Re: [PATCH] squash! completion: fill COMPREPLY directly when completing refs
From: SZEDER Gábor @ 2017-02-13 19:32 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git mailing list
In-Reply-To: <xmqq7f4xk9es.fsf@gitster.mtv.corp.google.com>
On Fri, Feb 10, 2017 at 10:44 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Should I expect a reroll to come, or is this the only fix-up to the
> series that begins at <20170203025405.8242-1-szeder.dev@gmail.com>?
>
> No hurries.
Yes, definitely.
I found a minor bug in the middle of the series, and haven't quite
made up my mind about it and its fix yet. Perhaps in a day or three.
Regarding the 'strip' -> 'lstrip' 'for-each-ref' format modifier
rename that broke pu: I should keep using 'strip', right?
Gábor
^ permalink raw reply
* Re: [RFC PATCH] show decorations at the end of the line
From: Linus Torvalds @ 2017-02-13 19:33 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <xmqq1sv2fq6m.fsf@gitster.mtv.corp.google.com>
On Mon, Feb 13, 2017 at 12:30 AM, Junio C Hamano <gitster@pobox.com> wrote:
>
> An obvious downside is that people (against all recommendations) are
> likely to have written a loose script expecting the --oneline format
> is cast in stone.
Actually, I don't believe that is the case wrt decorations.
Why?
If you script the --oneline format and parse the output, you won't
have any decorations at all unless you are crazy (you can set
"log.decorations=true", but that will truly screw up any scripting).
And if you actually want decorations, and you're parsing them, you are
*not* going to script it with "--oneline --decorations", because the
end result is basically impossible to parse already (because it's
ambiguous - think about parentheses in the commit message).
So if you actually want decorations for parsing, you'd do something like
git log --pretty="%h '%D' %s"
which is at least parseable (because now the decoration separator is
unconditional.
Yeah, I guess you could use "--decorations --color=always" and then
use the color codes to parse the decorations, but that's so
complicated as to be unrealistic.
And I considered adding a format string explanation, something along
the lines of
- oneline used to mean "--pretty=%h%d %s", now it means "%h %s%d" instead
but that's actually not true. The "oneline" format was much more
complex than that, in that it has special rules for "-g", and it has
all those colorization ones too.
Linus
^ permalink raw reply
* Re: [PATCH] fixup! bisect--helper: `bisect_next_check` & bisect_voc shell function in C
From: Pranit Bauva @ 2017-02-13 19:34 UTC (permalink / raw)
To: Junio C Hamano; +Cc: René Scharfe, Johannes Schindelin, Git List
In-Reply-To: <xmqqinodewdr.fsf@gitster.mtv.corp.google.com>
Hey Junio,
On Tue, Feb 14, 2017 at 12:44 AM, Junio C Hamano <gitster@pobox.com> wrote:
> René Scharfe <l.s.r@web.de> writes:
>
>> Initializing to NULL is still the correct thing to do, of course --
>> together with removing the conditionals (or at least the negations).
>
> So, let's give Pranit a concrete "here is what we want to see
> squashed in", while you guys discuss peculiarity with various
> platforms and their system headers, which admittedly is a more
> interesting tangent ;-)
>
> There are early returns with "goto finish" even before _syn
> variables are first assigned to, so they would need to be
> initialized to NULL. The other two get their initial values
> right at the beginning, so they are OK.
>
> builtin/bisect--helper.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
> index 8cd6527bd1..6949e8e5ca 100644
> --- a/builtin/bisect--helper.c
> +++ b/builtin/bisect--helper.c
> @@ -280,7 +280,7 @@ static int bisect_next_check(const struct bisect_terms *terms,
> int missing_good = 1, missing_bad = 1, retval = 0;
> char *bad_ref = xstrfmt("refs/bisect/%s", terms->term_bad);
> char *good_glob = xstrfmt("%s-*", terms->term_good);
> - char *bad_syn, *good_syn;
> + char *bad_syn = NULL, *good_syn = NULL;
>
> if (ref_exists(bad_ref))
> missing_bad = 0;
> @@ -341,14 +341,10 @@ static int bisect_next_check(const struct bisect_terms *terms,
> }
> goto finish;
> finish:
> - if (!bad_ref)
> - free(bad_ref);
> - if (!good_glob)
> - free(good_glob);
> - if (!bad_syn)
> - free(bad_syn);
> - if (!good_syn)
> - free(good_syn);
> + free(bad_ref);
> + free(good_glob);
> + free(bad_syn);
> + free(good_syn);
> return retval;
> }
This helps a lot ;) Thanks!
Regards,
Pranit Bauva
^ permalink raw reply
* Re: [PATCH] mingw: use OpenSSL's SHA-1 routines
From: Junio C Hamano @ 2017-02-13 19:42 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Johannes Schindelin, Jeff King, git, Jeff Hostetler
In-Reply-To: <9913e513-553e-eba6-e81a-9c21030dd767@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
> The patch does add a new runtime dependency on libcrypto.dll in my
> environment. I would be surprised if it does not also with your modern
> build tools.
>
> I haven't had time to compare test suite runtimes.
>
>> I'm open to the argument that it doesn't matter in practice for normal
>> git users. But it's not _just_ scripting. It depends on the user's
>> pattern of invoking git commands (and how expensive the symbol
>> resolution is on their system).
>
> It can be argued that in normal interactive use, it is hard to notice
> that another DLL is loaded. Don't forget, though, that on Windows it
> is not only the pure time to resolve the entry points, but also that
> typically virus scanners inspect every executable file that is loaded,
> which adds another share of time.
>
> I'll use the patch for daily work for a while to see whether it hurts.
Thanks.
I need to ask an unrelated question at a bit higher level, though.
I have been operating under the assumption that everybody on Windows
who builds Git works off of Dscho's Git for Windows tree, and
patches that are specific to Windows from Dscho's are sent to me via
the list only after they have been in Git for Windows and proven to
help Windows users in the wild.
The consequence of these two assumptions is that I would feel safe
to treat Windows specific changes that do not touch generic part of
the codebase from Dscho just like updates from any other subsystem
maintainers (any git-svn thing from Eric, any gitk thing from Paul,
any p4 thing Luke and Lars are both happy with, etc.).
You seem to be saying that the first of the two assumptions does not
hold. Should I change my expectations while queuing Windows specific
patches from Dscho?
^ permalink raw reply
* Re: [PATCH 2/2 v3] sha1_name: teach get_sha1_1 "-" shorthand for "@{-1}"
From: Junio C Hamano @ 2017-02-13 19:51 UTC (permalink / raw)
To: Matthieu Moy; +Cc: Siddharth Kannan, git, pranit.bauva, peff, pclouds, sandals
In-Reply-To: <vpqbmu768on.fsf@anie.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
> Siddharth Kannan <kannan.siddharth12@gmail.com> writes:
>
>> + if (!strcmp(name, "-")) {
>> + name = "@{-1}";
>> + len = 5;
>> + }
>
> One drawback of this approach is that further error messages will be
> given from the "@{-1}" string that the user never typed.
Right.
> There are at least:
>
> $ git grep -n -A1 'strcmp.*"-"' | grep -B 1 '@\{1\}'
> builtin/checkout.c:975: if (!strcmp(arg, "-"))
> builtin/checkout.c-976- arg = "@{-1}";
I didn't check the surrounding context to be sure, but I think this
"- to @{-1}" conversion cannot be delegated down to revision parsing
that eventually wants to return a 40-hex as the result.
We do want a branch _name_ sometimes when we say "@{-1}"; "checkout
master" (i.e. checkout by name) and "checkout master^0" (i.e. the
same commit object, but not by name) do different things.
> builtin/merge.c:1231: } else if (argc == 1 && !strcmp(argv[0], "-")) {
> builtin/merge.c-1232- argv[0] = "@{-1}";
> --
> builtin/revert.c:158: if (!strcmp(argv[1], "-"))
> builtin/revert.c-159- argv[1] = "@{-1}";
These should be safe to delegate down.
> builtin/worktree.c:344: if (!strcmp(branch, "-"))
> builtin/worktree.c-345- branch = "@{-1}";
I do not know about this one, but it smells like a branch name that
wants to be used before it gets turned into 40-hex.
^ permalink raw reply
* Re: [PATCH 2/2 v3] sha1_name: teach get_sha1_1 "-" shorthand for "@{-1}"
From: Junio C Hamano @ 2017-02-13 20:03 UTC (permalink / raw)
To: Siddharth Kannan, Matthieu Moy; +Cc: git, pranit.bauva, peff, pclouds, sandals
In-Reply-To: <xmqq1sv1euob.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
>
>> Siddharth Kannan <kannan.siddharth12@gmail.com> writes:
>>
>>> + if (!strcmp(name, "-")) {
>>> + name = "@{-1}";
>>> + len = 5;
>>> + }
>>
>> One drawback of this approach is that further error messages will be
>> given from the "@{-1}" string that the user never typed.
>
> Right.
>
>> There are at least:
>>
>> $ git grep -n -A1 'strcmp.*"-"' | grep -B 1 '@\{1\}'
>> builtin/checkout.c:975: if (!strcmp(arg, "-"))
>> builtin/checkout.c-976- arg = "@{-1}";
>
> I didn't check the surrounding context to be sure, but I think this
> "- to @{-1}" conversion cannot be delegated down to revision parsing
> that eventually wants to return a 40-hex as the result.
>
> We do want a branch _name_ sometimes when we say "@{-1}"; "checkout
> master" (i.e. checkout by name) and "checkout master^0" (i.e. the
> same commit object, but not by name) do different things.
FYI, the "@{-<number>} to branch name" translation happens in
interpret_branch_name(). I do not offhand recall if any callers
protect their calls to the function with conditionals that assume
the thing must begin with "@{" or cannot begin with "-" (the latter
of which is similar to the topic of patch 1/2 of this series), but I
suspect that teaching the function that "-" means the same as
"@{-1}" would bring us closer to where we want to go.
^ permalink raw reply
* Re: [PATCH v3 0/5] stash: support pathspec argument
From: Jeff King @ 2017-02-13 20:09 UTC (permalink / raw)
To: Matthieu Moy
Cc: Thomas Gummerer, git, Stephan Beyer, Junio C Hamano,
Marc Strapetz, Johannes Schindelin, Øyvind A . Holm,
Jakub Narębski
In-Reply-To: <vpq7f4uxjmo.fsf@anie.imag.fr>
On Mon, Feb 13, 2017 at 03:14:55PM +0100, Matthieu Moy wrote:
> I don't remember doing this intentionally. The goal was really to
> prevent typos like "git stash -p drop" (which would have been
> interpreted as "git stash save -p drop" previously). So, let's consider
> this "only messages starting with - are accepted" as a bug: moving to
> the new "push" command it a nice opportunity to fix it without worrying
> about compatibility. A bit more about this in this old thread:
Yeah, I consider it a bug that we treat "-foo" as a message there.
Fortunately I think you really have to try hard to abuse it:
# doesn't work, because "save" complains about "-foo" as an option
git stash -foo
# does save stash with message "-foo"
git stash -- -foo
# doesn't work, because _any_ non-option argument is rejected
git stash -- use --foo option
> I think we can safely allow both
>
> git stash -p -- <pathspec...>
> git stash push -p <pathspec...>
>
> But allowing the same without -- is a bit more dangerous for the reason
> above:
>
> git stash -p drop
>
> would be interpreted as
>
> git stash push -p drop
>
> (i.e. limit the stash to file named "drop"), and this would almost
> certainly not be what the user wanted.
Is it really that dangerous, though? The likely outcome is Git saying
"nope, you don't have any changes to the file named drop". Of course the
user may have meant something different, but I feel like "-p" is a good
indicator that they are interested in making an actual stash.
Think about this continuum of commands:
1. git stash droop
2. git stash -p drop
3. git stash -p -- drop
4. git stash push -p drop
I think we can all agree that (4) is reasonable and safe. And I suspect
we'd all agree that (1) is suspect (you probably meant "drop", not "push
droop").
But between (2) and (3), I don't see much difference. The interesting
difference between (1) and (2) is the addition of "-p", which tells us
that the user expects to save a stash.
Another way of thinking of it is that "-p" as a command name is an alias
for "push -p". If you wanted to err on the conservative side, you could
literally implement it that way (so "git stash -k -p foo" would not
work; you'd have to use "git stash -p -k foo").
> > The other question is how we would deal with the -m flag for
> > specifying a stash message. I think we could special case it, but
> > that would allow users to do things such as git stash -m apply, which
> > would make the interface a bit more error prone. So I'm leaning
> > towards disallowing that for now.
>
> We already have "git commit -m <msg> <pathspec...>", so I think stash
> should just do the same thing as commit. Or, did I miss something?
The complexity is that right now, the first-level decision of "which
stash sub-command am I running?" doesn't know about any options. So "git
stash -m foo" would be rejected in the name of typo prevention, unless
that outer decision learns about "-m" as an option.
-Peff
^ permalink raw reply
* Re: [PATCH 01/11] refs-internal.c: make files_log_ref_write() static
From: Ramsay Jones @ 2017-02-13 20:14 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy, git
Cc: Junio C Hamano, Michael Haggerty, Johannes Schindelin, sbeller,
novalis
In-Reply-To: <20170213152011.12050-2-pclouds@gmail.com>
On 13/02/17 15:20, Nguyễn Thái Ngọc Duy wrote:
> Created in 5f3c3a4e6f (files_log_ref_write: new function - 2015-11-10)
> but probably never used outside refs-internal.c
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> refs/files-backend.c | 3 +++
> refs/refs-internal.h | 4 ----
> 2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/refs/files-backend.c b/refs/files-backend.c
> index cdb6b8ff5..75565c3aa 100644
> --- a/refs/files-backend.c
> +++ b/refs/files-backend.c
> @@ -165,6 +165,9 @@ static struct ref_entry *create_dir_entry(struct files_ref_store *ref_store,
> const char *dirname, size_t len,
> int incomplete);
> static void add_entry_to_dir(struct ref_dir *dir, struct ref_entry *entry);
> +static int files_log_ref_write(const char *refname, const unsigned char *old_sha1,
> + const unsigned char *new_sha1, const char *msg,
> + int flags, struct strbuf *err);
Why? I don't like adding forward declarations unless it
is absolutely necessary (ie mutually recursive functions),
and even in the current 'pu' branch (@c04899d50), the
definition of this function appears before all uses in
this file. (ie, just add static to the definition).
What am I missing?
ATB,
Ramsay Jones
>
> static struct ref_dir *get_ref_dir(struct ref_entry *entry)
> {
> diff --git a/refs/refs-internal.h b/refs/refs-internal.h
> index 33adbf93b..59e65958a 100644
> --- a/refs/refs-internal.h
> +++ b/refs/refs-internal.h
> @@ -222,10 +222,6 @@ struct ref_transaction {
> enum ref_transaction_state state;
> };
>
> -int files_log_ref_write(const char *refname, const unsigned char *old_sha1,
> - const unsigned char *new_sha1, const char *msg,
> - int flags, struct strbuf *err);
> -
> /*
> * Check for entries in extras that are within the specified
> * directory, where dirname is a reference directory name including
>
^ permalink raw reply
* Re: [PATCH] squash! completion: fill COMPREPLY directly when completing refs
From: Junio C Hamano @ 2017-02-13 20:24 UTC (permalink / raw)
To: SZEDER Gábor; +Cc: Git mailing list
In-Reply-To: <CAM0VKj=Pai0fL7KtMdv1sg3N2KA1aBafGQ_XzXWKUsBmo62ZoA@mail.gmail.com>
SZEDER Gábor <szeder.dev@gmail.com> writes:
> On Fri, Feb 10, 2017 at 10:44 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
>> Should I expect a reroll to come, or is this the only fix-up to the
>> series that begins at <20170203025405.8242-1-szeder.dev@gmail.com>?
>>
>> No hurries.
>
> Yes, definitely.
>
> I found a minor bug in the middle of the series, and haven't quite
> made up my mind about it and its fix yet. Perhaps in a day or three.
>
> Regarding the 'strip' -> 'lstrip' 'for-each-ref' format modifier
> rename that broke pu: I should keep using 'strip', right?
Right. I view the removal of 'strip' as an accident when 'lstrip'
was introduced, not an intended change.
^ permalink raw reply
* Re: Bug in 'git describe' if I have two tags on the same commit.
From: Junio C Hamano @ 2017-02-13 20:35 UTC (permalink / raw)
To: Kevin Daudt; +Cc: Istvan Pato, git
In-Reply-To: <20170213154407.GA31568@alpha.ikke.info>
Kevin Daudt <me@ikke.info> writes:
> On Sun, Feb 12, 2017 at 01:15:22PM +0100, Istvan Pato wrote:
>
>> (master) [1] % git show-ref --tag
>> 76c634390... refs/tags/1.0.0
>> b77c7cd17... refs/tags/1.1.0
>> b77c7cd17... refs/tags/1.2.0
>>
>> (master) % git describe --tags --always
>> 1.1.0-1-ge9e9ced
>>
>> ### Expected: 1.2.0
>> ...
>
> Are these lightweight tags? Only annotated tags have a date associated
> to them, which is where the rel-notes refers to.
Good eyes. The fact that the two points at the same object means
that even if they were both annotated tags, they have the same
tagger dates.
If the code that compares the candidates and picks better tag to
describe the object with knows the refnames of these "tags", I'd
imagine that we could use the versioncmp() logic as the final tie
breaker, but I do not offhand remember if the original refname we
took the tag (or commit) from is propagated that deep down the
callchain. It probably does not, so some code refactoring may be
needed if somebody wants to go in that direction.
^ permalink raw reply
* [PATCH] docs/gitremote-helpers: fix unbalanced quotes
From: Jeff King @ 2017-02-13 20:38 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
Each of these options is missing the closing single-quote on
the option name. This understandably confuses asciidoc,
which ends up rendering a stray quote, like:
option cloning {'true|false}
Signed-off-by: Jeff King <peff@peff.net>
---
Documentation/gitremote-helpers.txt | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Documentation/gitremote-helpers.txt b/Documentation/gitremote-helpers.txt
index 9e8681f9e..7e59c50b1 100644
--- a/Documentation/gitremote-helpers.txt
+++ b/Documentation/gitremote-helpers.txt
@@ -452,14 +452,14 @@ set by Git if the remote helper has the 'option' capability.
Request the helper to perform a force update. Defaults to
'false'.
-'option cloning {'true'|'false'}::
+'option cloning' {'true'|'false'}::
Notify the helper this is a clone request (i.e. the current
repository is guaranteed empty).
-'option update-shallow {'true'|'false'}::
+'option update-shallow' {'true'|'false'}::
Allow to extend .git/shallow if the new refs require it.
-'option pushcert {'true'|'false'}::
+'option pushcert' {'true'|'false'}::
GPG sign pushes.
SEE ALSO
--
2.12.0.rc1.466.g70234cfd8
^ permalink raw reply related
* Re: [PATCH 02/11] files-backend: convert git_path() to strbuf_git_path()
From: Ramsay Jones @ 2017-02-13 20:38 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy, git
Cc: Junio C Hamano, Michael Haggerty, Johannes Schindelin, sbeller,
novalis
In-Reply-To: <20170213152011.12050-3-pclouds@gmail.com>
On 13/02/17 15:20, Nguyễn Thái Ngọc Duy wrote:
> git_path() and friends are going to be killed in files-backend.c in near
> future. And because there's a risk with overwriting buffer in
> git_path(), let's convert them all to strbuf_git_path(). We'll have
> easier time killing/converting strbuf_git_path() then because we won't
> have to worry about memory management again.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> refs/files-backend.c | 114 ++++++++++++++++++++++++++++++++++++++++-----------
> 1 file changed, 90 insertions(+), 24 deletions(-)
>
> diff --git a/refs/files-backend.c b/refs/files-backend.c
> index 75565c3aa..6582c9b2d 100644
> --- a/refs/files-backend.c
> +++ b/refs/files-backend.c
> @@ -2169,6 +2169,8 @@ static int lock_packed_refs(struct files_ref_store *refs, int flags)
> static int timeout_configured = 0;
> static int timeout_value = 1000;
> struct packed_ref_cache *packed_ref_cache;
> + struct strbuf sb = STRBUF_INIT;
> + int ret;
>
> files_assert_main_repository(refs, "lock_packed_refs");
>
> @@ -2177,10 +2179,13 @@ static int lock_packed_refs(struct files_ref_store *refs, int flags)
> timeout_configured = 1;
> }
>
> - if (hold_lock_file_for_update_timeout(
> - &packlock, git_path("packed-refs"),
> - flags, timeout_value) < 0)
> + strbuf_git_path(&sb, "packed-refs");
> + ret = hold_lock_file_for_update_timeout(&packlock, sb.buf,
> + flags, timeout_value);
> + strbuf_release(&sb);
> + if (ret < 0)
> return -1;
> +
> /*
> * Get the current packed-refs while holding the lock. If the
> * packed-refs file has been modified since we last read it,
> @@ -2335,6 +2340,9 @@ static void try_remove_empty_parents(char *name)
> for (q = p; *q; q++)
> ;
> while (1) {
> + struct strbuf sb = STRBUF_INIT;
> + int ret;
> +
> while (q > p && *q != '/')
> q--;
> while (q > p && *(q-1) == '/')
> @@ -2342,7 +2350,10 @@ static void try_remove_empty_parents(char *name)
> if (q == p)
> break;
> *q = '\0';
> - if (rmdir(git_path("%s", name)))
> + strbuf_git_path(&sb, "%s", name);
> + ret = rmdir(sb.buf);
> + strbuf_release(&sb);
> + if (ret)
> break;
> }
> }
> @@ -2431,7 +2442,11 @@ static int repack_without_refs(struct files_ref_store *refs,
> return 0; /* no refname exists in packed refs */
>
> if (lock_packed_refs(refs, 0)) {
> - unable_to_lock_message(git_path("packed-refs"), errno, err);
> + struct strbuf sb = STRBUF_INIT;
> +
> + strbuf_git_path(&sb, "packed-refs");
> + unable_to_lock_message(sb.buf, errno, err);
> + strbuf_release(&sb);
> return -1;
> }
> packed = get_packed_refs(refs);
> @@ -2529,11 +2544,12 @@ static int rename_tmp_log(const char *newrefname)
> {
> int attempts_remaining = 4;
> struct strbuf path = STRBUF_INIT;
> + struct strbuf tmp_renamed_log = STRBUF_INIT;
> int ret = -1;
>
> - retry:
> - strbuf_reset(&path);
> strbuf_git_path(&path, "logs/%s", newrefname);
> + strbuf_git_path(&tmp_renamed_log, TMP_RENAMED_LOG);
> + retry:
> switch (safe_create_leading_directories_const(path.buf)) {
> case SCLD_OK:
> break; /* success */
> @@ -2546,7 +2562,7 @@ static int rename_tmp_log(const char *newrefname)
> goto out;
> }
>
> - if (rename(git_path(TMP_RENAMED_LOG), path.buf)) {
> + if (rename(tmp_renamed_log.buf, path.buf)) {
> if ((errno==EISDIR || errno==ENOTDIR) && --attempts_remaining > 0) {
> /*
> * rename(a, b) when b is an existing
> @@ -2574,6 +2590,7 @@ static int rename_tmp_log(const char *newrefname)
> ret = 0;
> out:
> strbuf_release(&path);
> + strbuf_release(&tmp_renamed_log);
> return ret;
> }
>
> @@ -2614,9 +2631,15 @@ static int files_rename_ref(struct ref_store *ref_store,
> int flag = 0, logmoved = 0;
> struct ref_lock *lock;
> struct stat loginfo;
> - int log = !lstat(git_path("logs/%s", oldrefname), &loginfo);
> + struct strbuf sb_oldref = STRBUF_INIT;
> + struct strbuf sb_newref = STRBUF_INIT;
> + struct strbuf tmp_renamed_log = STRBUF_INIT;
> + int log, ret;
> struct strbuf err = STRBUF_INIT;
>
> + strbuf_git_path(&sb_oldref, "logs/%s", oldrefname);
> + log = !lstat(sb_oldref.buf, &loginfo);
> + strbuf_release(&sb_oldref);
> if (log && S_ISLNK(loginfo.st_mode))
> return error("reflog for %s is a symlink", oldrefname);
>
> @@ -2630,7 +2653,12 @@ static int files_rename_ref(struct ref_store *ref_store,
> if (!rename_ref_available(oldrefname, newrefname))
> return 1;
>
> - if (log && rename(git_path("logs/%s", oldrefname), git_path(TMP_RENAMED_LOG)))
> + strbuf_git_path(&sb_oldref, "logs/%s", oldrefname);
> + strbuf_git_path(&tmp_renamed_log, TMP_RENAMED_LOG);
> + ret = log && rename(sb_oldref.buf, tmp_renamed_log.buf);
It probably won't make too much difference, but the two code
sequences above are not similar in terms of side-effects when
'log' is false. In that case, the two calls to git_path() and
the call to rename() are not made in the original code. In the
new sequence, the two calls to strbuf_git_path() are always made
(but rename() is not).
> + strbuf_release(&sb_oldref);
> + strbuf_release(&tmp_renamed_log);
> + if (ret)
> return error("unable to move logfile logs/%s to "TMP_RENAMED_LOG": %s",
> oldrefname, strerror(errno));
>
> @@ -2709,13 +2737,19 @@ static int files_rename_ref(struct ref_store *ref_store,
> log_all_ref_updates = flag;
>
> rollbacklog:
> - if (logmoved && rename(git_path("logs/%s", newrefname), git_path("logs/%s", oldrefname)))
> + strbuf_git_path(&sb_newref, "logs/%s", newrefname);
> + strbuf_git_path(&sb_oldref, "logs/%s", oldrefname);
> + if (logmoved && rename(sb_newref.buf, sb_oldref.buf))
ditto
> error("unable to restore logfile %s from %s: %s",
> oldrefname, newrefname, strerror(errno));
> + strbuf_git_path(&tmp_renamed_log, TMP_RENAMED_LOG);
> if (!logmoved && log &&
> - rename(git_path(TMP_RENAMED_LOG), git_path("logs/%s", oldrefname)))
> + rename(tmp_renamed_log.buf, sb_oldref.buf))
similar
> error("unable to restore logfile %s from "TMP_RENAMED_LOG": %s",
> oldrefname, strerror(errno));
> + strbuf_release(&sb_newref);
> + strbuf_release(&sb_oldref);
> + strbuf_release(&tmp_renamed_log);
>
> return 1;
> }
ATB,
Ramsay Jones
^ permalink raw reply
* Re: [PATCH] clean: use warning_errno() when appropriate
From: Junio C Hamano @ 2017-02-13 20:38 UTC (permalink / raw)
To: Jeff King; +Cc: Nguyễn Thái Ngọc Duy, git
In-Reply-To: <20170213191433.muwhz7zem64p3rxr@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> I wonder if xmalloc() should be the one doing the saved_errno trick.
> After all, it has only two outcomes: we successfully allocated the
> memory, or we called die().
I would be lying if I said I did not considered it when I wrote the
message you are responding to, but I rejected it because that would
be optimizing for a wrong case, in that most callers of xmalloc()
and friends do not do so in the error codepath, and we would be
penalizing them by doing the saved_errno dance unconditionally.
^ permalink raw reply
* Re: Small regression on Windows
From: Jeff Hostetler @ 2017-02-13 20:32 UTC (permalink / raw)
To: Johannes Sixt, Johannes Schindelin, Jeff Hostetler
Cc: Junio C Hamano, Git Mailing List
In-Reply-To: <6bc02b0a-a463-1f0c-3fee-ba27dd2482e4@kdbg.org>
On 2/13/2017 1:00 PM, Johannes Sixt wrote:
> Please type this, preferably outside of any repo to avoid that it is
> changed; note the command typo:
>
> git -c help.autocorrect=40 ceckout
>
> Git waits for 4 seconds, but does not write anything until just before
> it exits. It bisects to
>
> a9b8a09c3c30886c79133da9f48ef9f98c21c3b2 is the first bad commit
> commit a9b8a09c3c30886c79133da9f48ef9f98c21c3b2
> Author: Jeff Hostetler <jeffhost@microsoft.com>
> Date: Thu Dec 22 18:09:23 2016 +0100
>
> mingw: replace isatty() hack
>
> Git for Windows has carried a patch that depended on internals
> of MSVC runtime, but it does not work correctly with recent MSVC
> runtime. A replacement was written originally for compiling
> with VC++. The patch in this message is a backport of that
> replacement, and it also fixes the previous attempt to make
> isatty() tell that /dev/null is *not* an interactive terminal.
>
> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
> Tested-by: Beat Bolli <dev+git@drbeat.li>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
>
> :040000 040000 bc3c75bdfc766fe478e160a9452c31bfef50b505
> f7183c3a0726fef7161d5f9ff8c997260025f1bb M compat
>
> Any ideas? I haven't had time to dig any further.
I'm investigating now.
The warning text is being written to stderr and then main thread sleeps
for the 4 seconds.
However, stderr has been redirected to the pipe connected to the
console_thread that
handles the coloring/pager. It is in a blocking ReadFile on the pipe
and is thus stuck until
the main thread runs the corrected command and closes the pipe. It then
sees the EOF
and prints everything in the pipe buffer.
I'll look into fixing this now.
Jeff
^ permalink raw reply
* Re: [PATCH 03/11] files-backend: add files_path()
From: Ramsay Jones @ 2017-02-13 20:43 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy, git
Cc: Junio C Hamano, Michael Haggerty, Johannes Schindelin, sbeller,
novalis
In-Reply-To: <20170213152011.12050-4-pclouds@gmail.com>
On 13/02/17 15:20, Nguyễn Thái Ngọc Duy wrote:
> This will be the replacement for both git_path() and git_path_submodule()
> in this file. The idea is backend takes a git path and use that,
> oblivious of submodule, linked worktrees and such.
>
> This is the middle step towards that. Eventually the "submodule" field
> in 'struct files_ref_store' should be replace by "gitdir". And a
> compound ref_store is created to combine two files backends together,
> one represents the shared refs in $GIT_COMMON_DIR, one per-worktree. At
> that point, files_path() becomes a wrapper of strbuf_vaddf().
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> refs/files-backend.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/refs/files-backend.c b/refs/files-backend.c
> index 6582c9b2d..39217a2ca 100644
> --- a/refs/files-backend.c
> +++ b/refs/files-backend.c
> @@ -169,6 +169,9 @@ static int files_log_ref_write(const char *refname, const unsigned char *old_sha
> const unsigned char *new_sha1, const char *msg,
> int flags, struct strbuf *err);
>
> +void files_path(struct files_ref_store *refs, struct strbuf *sb,
> + const char *fmt, ...) __attribute__((format (printf, 3, 4)));
> +
Why?
> static struct ref_dir *get_ref_dir(struct ref_entry *entry)
> {
> struct ref_dir *dir;
> @@ -930,6 +933,23 @@ struct files_ref_store {
> /* Lock used for the main packed-refs file: */
> static struct lock_file packlock;
>
> +void files_path(struct files_ref_store *refs, struct strbuf *sb,
> + const char *fmt, ...)
> +{
> + struct strbuf tmp = STRBUF_INIT;
> + va_list vap;
> +
> + va_start(vap, fmt);
> + strbuf_vaddf(&tmp, fmt, vap);
> + va_end(vap);
> + if (refs->submodule)
> + strbuf_git_path_submodule(sb, refs->submodule,
> + "%s", tmp.buf);
> + else
> + strbuf_git_path(sb, "%s", tmp.buf);
> + strbuf_release(&tmp);
> +}
> +
> /*
> * Increment the reference count of *packed_refs.
> */
>
ATB,
Ramsay Jones
^ permalink raw reply
* Re: [PATCH] completion: restore removed line continuating backslash
From: Junio C Hamano @ 2017-02-13 20:45 UTC (permalink / raw)
To: SZEDER Gábor; +Cc: git
In-Reply-To: <20170213192036.10671-1-szeder.dev@gmail.com>
SZEDER Gábor <szeder.dev@gmail.com> writes:
> Recent commit 1cd23e9e0 (completion: don't use __gitdir() for git
> commands, 2017-02-03) rewrapped a couple of long lines, and while
> doing so it inadvertently removed a '\' from the end of a line, thus
> breaking completion for 'git config remote.name.push <TAB>'.
>
> Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
> ---
>
> I wanted this to be a fixup!, but then noticed that this series is
> already in next, hence the proper commit message.
We get "--format=... : command not found"?
Thanks for a set of sharp eyes.
> I see the last What's cooking marks this series as "will merge to
> master". That doesn't mean that it will be in v2.12, does it?
I actually was hoping that these can go in. Others that can (or
should) wait are marked as "Will cook in 'next'".
If you feel uncomfortable and want these to cook longer, please tell
me so.
Thanks.
> contrib/completion/git-completion.bash | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 993085af6..f2b294aac 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -2086,7 +2086,7 @@ _git_config ()
> remote.*.push)
> local remote="${prev#remote.}"
> remote="${remote%.push}"
> - __gitcomp_nl "$(__git for-each-ref
> + __gitcomp_nl "$(__git for-each-ref \
> --format='%(refname):%(refname)' refs/heads)"
> return
> ;;
^ permalink raw reply
* Re: Small regression on Windows
From: Junio C Hamano @ 2017-02-13 20:47 UTC (permalink / raw)
To: Jeff Hostetler
Cc: Johannes Sixt, Johannes Schindelin, Jeff Hostetler,
Git Mailing List
In-Reply-To: <8488f55c-37b1-1ded-53c5-7cd268210391@jeffhostetler.com>
Jeff Hostetler <git@jeffhostetler.com> writes:
> The warning text is being written to stderr and then main thread
> sleeps for the 4 seconds. However, stderr has been redirected to
> the pipe connected to the console_thread that handles the
> coloring/pager. It is in a blocking ReadFile on the pipe and is
> thus stuck until the main thread runs the corrected command and
> closes the pipe. It then sees the EOF and prints everything in
> the pipe buffer.
IOW, somehow your stderr is not flushing automatically?
> I'll look into fixing this now.
Thanks.
^ permalink raw reply
* Re: Incorrect pipe for git log graph when using --name-status option
From: hIpPy @ 2017-02-13 20:55 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <xmqqa89pevw0.fsf@gitster.mtv.corp.google.com>
On Mon, Feb 13, 2017 at 11:25 AM, Junio C Hamano <gitster@pobox.com> wrote:
> hIpPy <hippy2981@gmail.com> writes:
>
>> The `git log` command with `graph` and pretty format works correctly
>> as expected.
>>
>> $ git log --graph --pretty=format:'%h' -2
>> * 714a14e
>> * 87dce5f
>>
>>
>> However, with `--name-status` option added, there is a pipe
>> incorrectly placed after the commit hash (example below).
>>
>> $ git log --graph --pretty=format:'%h' -2 --name-status
>> * 714a14e|
>> | M README.md
>
> Is it a --name-status, or is it your own custom format, that is
> causing the above issue?
>
> - What happens if you stop using --pretty=format:%h and replace it
> with something like --oneline?
>
> - What happens if you keep using --pretty=format:%h but replace
> --name-status with something else, e.g. --raw or --stat?
>
- What happens if you stop using --pretty=format:%h and replace it
with something like --oneline?
--oneline works correctly as expected (example below).
$ git log --graph --oneline -2 --name-status
* bf7ace7daf (HEAD -> rm/option-for-name-status) wip: --ns for --name-status
| M diff.c
* 592e5c5bce (origin/master, origin/HEAD, master) Merge pull request
#994 from jeffhostetler/jeffhostetler/fscache_nfd
|\
- What happens if you keep using --pretty=format:%h but replace
--name-status with something else, e.g. --raw or --stat?
I see the same issue with --raw and --stat (examples below).
$ git log --graph --pretty=format:'%h' -2 --raw
* bf7ace7daf|
| :100644 100644 84dba60c40... 87dfabf4a9... M diff.c
* 592e5c5bce
|\
$ git log --graph --pretty=format:'%h' -2 --stat
* bf7ace7daf|
| diff.c | 2 +-
| 1 file changed, 1 insertion(+), 1 deletion(-)
* 592e5c5bce
|\
I believe it's not my custom format that is causing the issue.
I'm including this information that may not be relevant. I apologize
in advance for that. I had simplified the custom format in my
previous email. For below custom format I still see the pipe
incorrectly placed.
$ git log --graph --date=relative --decorate --abbrev-commit
--format=format:'%h - %aD (%ar)%d%n %s - %an' -2 --name-status
* bf7ace7daf - Mon, 6 Feb 2017 13:09:32 -0800 (7 days ago) (HEAD ->
rm/option-for-name-status)
| wip: --ns for --name-status - Rishikesh Mandvikar|
| M diff.c
* 592e5c5bce - Wed, 1 Feb 2017 16:35:30 +0100 (12 days ago)
(origin/master, origin/HEAD, master)
|\ Merge pull request #994 from
jeffhostetler/jeffhostetler/fscache_nfd - Johannes Schindelin
If I were to put a '%n' at the end (example below), the pipe is
correctly placed with or without the --name-status option. But in
case of "without the --name-status option", there is an extra blank
line. It seems that my custom format is requiring a %n at the end. I
consider my custom format as a --twoline option and I feel the
behavior should match --oneline when using options.
With --name-status: This works correctly.
$ git log --graph --date=relative --decorate --abbrev-commit
--format=format:'%h - %aD (%ar)%d%n %s - %an%n' -2 --name-status
* bf7ace7daf - Mon, 6 Feb 2017 13:09:32 -0800 (7 days ago) (HEAD ->
rm/option-for-name-status)
| wip: --ns for --name-status - Rishikesh Mandvikar
|
| M diff.c
|
* 592e5c5bce - Wed, 1 Feb 2017 16:35:30 +0100 (12 days ago)
(origin/master, origin/HEAD, master)
|\ Merge pull request #994 from
jeffhostetler/jeffhostetler/fscache_nfd - Johannes Schindelin
Without --name-status: This works but has extra blank line between
commits though.
$ git log --graph --date=relative --decorate --abbrev-commit
--format=format:'%h - %aD (%ar)%d%n %s - %an%n' -2
* bf7ace7daf - Mon, 6 Feb 2017 13:09:32 -0800 (7 days ago) (HEAD ->
rm/option-for-name-status)
| wip: --ns for --name-status - Rishikesh Mandvikar
|
* 592e5c5bce - Wed, 1 Feb 2017 16:35:30 +0100 (12 days ago)
(origin/master, origin/HEAD, master)
|\ Merge pull request #994 from
jeffhostetler/jeffhostetler/fscache_nfd - Johannes Schindelin
I think that requiring to end custom formats with %n with options
is not good. So I think this is a bug.
Thanks,
RM
^ permalink raw reply
* Re: [PATCH 04/11] files-backend: replace *git_path*() with files_path()
From: Ramsay Jones @ 2017-02-13 20:58 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy, git
Cc: Junio C Hamano, Michael Haggerty, Johannes Schindelin, sbeller,
novalis
In-Reply-To: <20170213152011.12050-5-pclouds@gmail.com>
On 13/02/17 15:20, Nguyễn Thái Ngọc Duy wrote:
> This centralizes all path rewriting of files-backend.c in one place so
> we have easier time removing the path rewriting later. There could be
> some hidden indirect git_path() though, I didn't audit the code to the
> bottom.
>
> Side note: set_worktree_head_symref() is a bad boy and should not be in
> files-backend.c (probably should not exist in the first place). But
> we'll leave it there until we have better multi-worktree support in refs
> before we update it.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> refs/files-backend.c | 193 ++++++++++++++++++++++++++-------------------------
> 1 file changed, 98 insertions(+), 95 deletions(-)
>
> diff --git a/refs/files-backend.c b/refs/files-backend.c
> index 39217a2ca..c69e4fe84 100644
> --- a/refs/files-backend.c
> +++ b/refs/files-backend.c
> @@ -165,12 +165,13 @@ static struct ref_entry *create_dir_entry(struct files_ref_store *ref_store,
> const char *dirname, size_t len,
> int incomplete);
> static void add_entry_to_dir(struct ref_dir *dir, struct ref_entry *entry);
> -static int files_log_ref_write(const char *refname, const unsigned char *old_sha1,
> +static int files_log_ref_write(struct files_ref_store *refs,
> + const char *refname, const unsigned char *old_sha1,
> const unsigned char *new_sha1, const char *msg,
> int flags, struct strbuf *err);
>
> -void files_path(struct files_ref_store *refs, struct strbuf *sb,
> - const char *fmt, ...) __attribute__((format (printf, 3, 4)));
You only added this in the last commit, so maybe mark it static in
the previous patch! Also, just in case you were wondering, the 'Why?'
of the previous email was, "Why do you need this forward declaration?"
(hint: you don't ;-)
> +static void files_path(struct files_ref_store *refs, struct strbuf *sb,
> + const char *fmt, ...) __attribute__((format (printf, 3, 4)));
>
> static struct ref_dir *get_ref_dir(struct ref_entry *entry)
> {
> @@ -933,8 +934,8 @@ struct files_ref_store {
> /* Lock used for the main packed-refs file: */
> static struct lock_file packlock;
>
> -void files_path(struct files_ref_store *refs, struct strbuf *sb,
> - const char *fmt, ...)
> +static void files_path(struct files_ref_store *refs, struct strbuf *sb,
> + const char *fmt, ...)
> {
> struct strbuf tmp = STRBUF_INIT;
> va_list vap;
ATB,
Ramsay Jones
^ permalink raw reply
* Re: [RFC PATCH] show decorations at the end of the line
From: Junio C Hamano @ 2017-02-13 21:01 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <CA+55aFy-vvOBu5Y4KDeteUyK-7U7yTa1HoqHo+hME1=8bq7Xhw@mail.gmail.com>
Linus Torvalds <torvalds@linux-foundation.org> writes:
> And if you actually want decorations, and you're parsing them, you are
> *not* going to script it with "--oneline --decorations", because the
> end result is basically impossible to parse already (because it's
> ambiguous - think about parentheses in the commit message).
OK. So let's wait to hear from others if they like the "obviously"
improved output. Even though I find the decorations indispensable
in my "git log" output, I personally do not have much preference
either way, as my screen is often wide enough ;-)
Thanks. We'd need to update the tests that expects the old style
output, though.
^ permalink raw reply
* Re: [PATCH] rm: reuse strbuf for all remove_dir_recursively() calls, again
From: Stefan Beller @ 2017-02-13 21:03 UTC (permalink / raw)
To: René Scharfe; +Cc: Git List, Junio C Hamano
In-Reply-To: <f2549b5b-b3c8-3935-cdb9-9908914195b6@web.de>
On Sat, Feb 11, 2017 at 11:51 AM, René Scharfe <l.s.r@web.de> wrote:
> Don't throw the memory allocated for remove_dir_recursively() away after
> a single call, use it for the other entries as well instead.
>
> This change was done before in deb8e15a (rm: reuse strbuf for all
> remove_dir_recursively() calls), but was reverted as a side-effect of
> 55856a35 (rm: absorb a submodules git dir before deletion). Reinstate
> the optimization.
>
> Signed-off-by: Rene Scharfe <l.s.r@web.de>
> ---
> Was deb8e15a a rebase victim?
(I do not recall it off the top of my head)
That commit was merged at 03f25e85,
Merge branch 'rs/rm-strbuf-optim', but it looks
like it was reverted as part of 55856a35b2
(rm: absorb a submodules git dir before deletion)
Looking through the discussion at
https://public-inbox.org/git/xmqqmvfich2e.fsf@gitster.mtv.corp.google.com/
there was no apparent signs of confusion, but a reroll was promised, that
I cannot find on the list.
Anyway, the patch below looks good to me.
Thanks,
Stefan
>
> builtin/rm.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/builtin/rm.c b/builtin/rm.c
> index 452170a3ab..fb79dcab18 100644
> --- a/builtin/rm.c
> +++ b/builtin/rm.c
> @@ -360,15 +360,14 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
> */
> if (!index_only) {
> int removed = 0, gitmodules_modified = 0;
> + struct strbuf buf = STRBUF_INIT;
> for (i = 0; i < list.nr; i++) {
> const char *path = list.entry[i].name;
> if (list.entry[i].is_submodule) {
> - struct strbuf buf = STRBUF_INIT;
> -
> + strbuf_reset(&buf);
> strbuf_addstr(&buf, path);
> if (remove_dir_recursively(&buf, 0))
> die(_("could not remove '%s'"), path);
> - strbuf_release(&buf);
>
> removed = 1;
> if (!remove_path_from_gitmodules(path))
> @@ -382,6 +381,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
> if (!removed)
> die_errno("git rm: '%s'", path);
> }
> + strbuf_release(&buf);
> if (gitmodules_modified)
> stage_updated_gitmodules();
> }
> --
> 2.11.1
>
^ permalink raw reply
* [PATCH] docs/git-submodule: fix unbalanced quote
From: Jeff King @ 2017-02-13 21:05 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
In-Reply-To: <20170213203835.vssj64tcvuq35dny@sigill.intra.peff.net>
The documentation gives an example of the submodule foreach
command that uses both backticks and single-quotes. We stick
the whole thing inside "+" markers to make it monospace, but
the inside punctuation still needs escaping. We handle the
backticks with "{backtick}", and use backslash-escaping for
the single-quotes.
But we missed the escaping on the second quote. Fortunately,
asciidoc renders this unbalanced quote as we want (showing
the quote), but asciidoctor does not. We could fix it by
adding the missing backslash.
However, let's take a step back. Even when rendered
correctly, it's hard to read a long command stuck into the
middle of a paragraph, and the important punctuation is hard
to notice. Let's instead bump it into its own single-line
code block. That makes both the source and the rendered
result more readable, and as a bonus we don't have to worry
about quoting at all.
Signed-off-by: Jeff King <peff@peff.net>
---
Not textually related to the previous fix, but obviously along the same
lines.
Documentation/git-submodule.txt | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index 918bd1d1b..a8eb1c7ce 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -228,9 +228,12 @@ foreach::
the processing to terminate. This can be overridden by adding '|| :'
to the end of the command.
+
-As an example, +git submodule foreach \'echo $path {backtick}git
-rev-parse HEAD{backtick}'+ will show the path and currently checked out
-commit for each submodule.
+As an example, the command below will show the path and currently
+checked out commit for each submodule:
++
+--------------
+git submodule foreach 'echo $path `git rev-parse HEAD`'
+--------------
sync::
Synchronizes submodules' remote URL configuration setting
--
2.12.0.rc1.466.g70234cfd8
^ permalink raw reply related
* Re: [PATCH] mingw: use OpenSSL's SHA-1 routines
From: Johannes Sixt @ 2017-02-13 21:07 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Schindelin, Jeff King, git, Jeff Hostetler
In-Reply-To: <xmqq60kdev2r.fsf@gitster.mtv.corp.google.com>
Am 13.02.2017 um 20:42 schrieb Junio C Hamano:
> I have been operating under the assumption that everybody on Windows
> who builds Git works off of Dscho's Git for Windows tree, and
> patches that are specific to Windows from Dscho's are sent to me via
> the list only after they have been in Git for Windows and proven to
> help Windows users in the wild.
>
> The consequence of these two assumptions is that I would feel safe
> to treat Windows specific changes that do not touch generic part of
> the codebase from Dscho just like updates from any other subsystem
> maintainers (any git-svn thing from Eric, any gitk thing from Paul,
> any p4 thing Luke and Lars are both happy with, etc.).
>
> You seem to be saying that the first of the two assumptions does not
> hold. Should I change my expectations while queuing Windows specific
> patches from Dscho?
Your first assumption is incorrect as far as I am concerned. I build
from your tree plus some topics. During -rc period, I build off of
master; after a release, I build off of next. I merge some of the topics
that you carry in pu when I find them interesting or when I suspect them
to regress on Windows. Then I carry around a few additional patches that
the public has never seen, and these days I also merge Dscho's rebase-i
topic.
-- Hannes
^ permalink raw reply
* Re: [PATCH] clean: use warning_errno() when appropriate
From: Jeff King @ 2017-02-13 21:10 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Nguyễn Thái Ngọc Duy, git
In-Reply-To: <xmqqk28tddwo.fsf@gitster.mtv.corp.google.com>
On Mon, Feb 13, 2017 at 12:38:47PM -0800, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> > I wonder if xmalloc() should be the one doing the saved_errno trick.
> > After all, it has only two outcomes: we successfully allocated the
> > memory, or we called die().
>
> I would be lying if I said I did not considered it when I wrote the
> message you are responding to, but I rejected it because that would
> be optimizing for a wrong case, in that most callers of xmalloc()
> and friends do not do so in the error codepath, and we would be
> penalizing them by doing the saved_errno dance unconditionally.
Yes, that also occurred to me. I'm not sure if two integer swaps is
enough to care about when compared to the cost of a malloc(), though.
IOW, I think this may be a case where we should be optimizing for
programmer time (fewer lines of code, and one less thing to worry about
in the callers) versus squeezing out every instruction.
-Peff
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox