* Re: merge maintaining history
From: Junio C Hamano @ 2017-01-20 17:33 UTC (permalink / raw)
To: Jakub Narębski; +Cc: David J. Bakeman, Jacob Keller, Git mailing list
In-Reply-To: <38ca43cb-2fc7-0448-352f-7d9413f815c5@gmail.com>
Jakub Narębski <jnareb@gmail.com> writes:
> Then you would have the above history in repositories that fetched
> refs/replace/*, and the one below if replacement info is absent:
>
> original A<-B<-C<-D<-E<-F<-----------M
> \ /
> first branch b<-c<-d<-e /
> /
> new repo e*<-f->g->h
>
> But as Junio said it is highly unlikely that you are in this situation.
I do not think I said it is highly unlikely. I just said that I
didn't read in what David wrote that he did some unusual things, so
I based my conclusion on that assumption. People who bring problems
here sometimes forget to tell crucial details, and that missing
piece of information often changes how the situation should be
handled.
^ permalink raw reply
* [PATCH v2 0/2] grep: make output consistent with revision syntax
From: Stefan Hajnoczi @ 2017-01-20 17:11 UTC (permalink / raw)
To: git; +Cc: Jeff King, gitster, Brandon Williams, Stefan Hajnoczi
v2:
* Use obj->type instead of re-parsing name for delimiter
(Followed Brandon's suggestion but named the variable 'delim' since that
name is used in other places and 'del' is used for deletion.)
* Add tests
* Update Patch 1 commit description with a more relevant example
* PATCH instead of RFC, now works with all documented git-rev-parse(1) syntax
git-grep(1)'s output is not consistent with git-rev-parse(1) revision syntax.
This means you cannot take "rev:path/to/file.c: foo();" output from git-grep(1)
and expect "git show rev:path/to/file.c" to work. See the individual patches
for examples of command-lines that produce invalid output.
Stefan Hajnoczi (2):
grep: only add delimiter if there isn't one already
grep: use '/' delimiter for paths
builtin/grep.c | 8 +++++++-
t/t7810-grep.sh | 26 ++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletion(-)
--
2.9.3
^ permalink raw reply
* [PATCH v2 2/2] grep: use '/' delimiter for paths
From: Stefan Hajnoczi @ 2017-01-20 17:11 UTC (permalink / raw)
To: git; +Cc: Jeff King, gitster, Brandon Williams, Stefan Hajnoczi
In-Reply-To: <20170120171126.16269-1-stefanha@redhat.com>
If the tree contains a sub-directory then git-grep(1) output contains a
colon character instead of a path separator:
$ git grep malloc v2.9.3:t
v2.9.3:t:test-lib.sh: setup_malloc_check () {
$ git show v2.9.3:t:test-lib.sh
fatal: Path 't:test-lib.sh' does not exist in 'v2.9.3'
This patch attempts to use the correct delimiter:
$ git grep malloc v2.9.3:t
v2.9.3:t/test-lib.sh: setup_malloc_check () {
$ git show v2.9.3:t/test-lib.sh
(success)
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
builtin/grep.c | 4 +++-
t/t7810-grep.sh | 5 +++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/builtin/grep.c b/builtin/grep.c
index 90a4f3d..7a7aab9 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -494,7 +494,9 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
/* Add a delimiter if there isn't one already */
if (name[len - 1] != '/' && name[len - 1] != ':') {
- strbuf_addch(&base, ':');
+ /* rev: or rev:path/ */
+ char delim = obj->type == OBJ_COMMIT ? ':' : '/';
+ strbuf_addch(&base, delim);
}
}
init_tree_desc(&tree, data, size);
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index e804a3f..8a58d5e 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -1445,6 +1445,11 @@ test_expect_success 'grep outputs valid <rev>:<path> for HEAD:t/' '
test_cmp expected actual
'
+test_expect_success 'grep outputs valid <rev>:<path> for HEAD:t' '
+ git grep vvv HEAD:t >actual &&
+ test_cmp expected actual
+'
+
cat >expected <<EOF
HEAD:t/a/v:vvv
HEAD:t/v:vvv
--
2.9.3
^ permalink raw reply related
* [PATCH v2 1/2] grep: only add delimiter if there isn't one already
From: Stefan Hajnoczi @ 2017-01-20 17:11 UTC (permalink / raw)
To: git; +Cc: Jeff King, gitster, Brandon Williams, Stefan Hajnoczi
In-Reply-To: <20170120171126.16269-1-stefanha@redhat.com>
git-grep(1) output does not follow git's own syntax:
$ git grep malloc v2.9.3:t/
v2.9.3:t/:test-lib.sh: setup_malloc_check () {
$ git show v2.9.3:t/:test-lib.sh
fatal: Path 't/:test-lib.sh' does not exist in 'v2.9.3'
This patch avoids emitting the unnecessary ':' delimiter if the name
already ends with ':' or '/':
$ git grep malloc v2.9.3:
v2.9.3:t/test-lib.sh: setup_malloc_check () {
$ git show v2.9.3:t/test-lib.sh
(succeeds)
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
builtin/grep.c | 6 +++++-
t/t7810-grep.sh | 21 +++++++++++++++++++++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/builtin/grep.c b/builtin/grep.c
index 8887b6a..90a4f3d 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -491,7 +491,11 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
strbuf_init(&base, PATH_MAX + len + 1);
if (len) {
strbuf_add(&base, name, len);
- strbuf_addch(&base, ':');
+
+ /* Add a delimiter if there isn't one already */
+ if (name[len - 1] != '/' && name[len - 1] != ':') {
+ strbuf_addch(&base, ':');
+ }
}
init_tree_desc(&tree, data, size);
hit = grep_tree(opt, pathspec, &tree, &base, base.len,
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index de2405c..e804a3f 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -1435,4 +1435,25 @@ test_expect_success 'grep does not report i-t-a and assume unchanged with -L' '
test_cmp expected actual
'
+cat >expected <<EOF
+HEAD:t/a/v:vvv
+HEAD:t/v:vvv
+EOF
+
+test_expect_success 'grep outputs valid <rev>:<path> for HEAD:t/' '
+ git grep vvv HEAD:t/ >actual &&
+ test_cmp expected actual
+'
+
+cat >expected <<EOF
+HEAD:t/a/v:vvv
+HEAD:t/v:vvv
+HEAD:v:vvv
+EOF
+
+test_expect_success 'grep outputs valid <rev>:<path> for HEAD:' '
+ git grep vvv HEAD: >actual &&
+ test_cmp expected actual
+'
+
test_done
--
2.9.3
^ permalink raw reply related
* [PATCH] show-ref: Allow --head to work with --verify
From: Vladimir Panteleev @ 2017-01-20 15:50 UTC (permalink / raw)
To: git; +Cc: Vladimir Panteleev
Previously, when --verify was specified, --head was being ignored, and
"show-ref --verify --head HEAD" would always print "fatal: 'HEAD' -
not a valid ref". As such, when using show-ref to look up any
ref (including HEAD) precisely by name, one would have to special-case
looking up the HEAD ref.
This patch adds --head support to show-ref's --verify logic, by
explicitly checking if the "HEAD" ref is specified when --head is
present.
Signed-off-by: Vladimir Panteleev <git@thecybershadow.net>
---
builtin/show-ref.c | 2 ++
t/t1403-show-ref.sh | 8 ++++++++
2 files changed, 10 insertions(+)
diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index 6d4e66900..ee5078604 100644
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -207,6 +207,8 @@ int cmd_show_ref(int argc, const char **argv, const char *prefix)
if (!quiet)
show_one(*pattern, &oid);
}
+ else if (show_head && !strcmp(*pattern, "HEAD"))
+ head_ref(show_ref, NULL);
else if (!quiet)
die("'%s' - not a valid ref", *pattern);
else
diff --git a/t/t1403-show-ref.sh b/t/t1403-show-ref.sh
index 7e10bcfe3..de64ebfb7 100755
--- a/t/t1403-show-ref.sh
+++ b/t/t1403-show-ref.sh
@@ -164,4 +164,12 @@ test_expect_success 'show-ref --heads, --tags, --head, pattern' '
test_cmp expect actual
'
+test_expect_success 'show-ref --verify --head' '
+ {
+ echo $(git rev-parse HEAD) HEAD
+ } >expect &&
+ git show-ref --verify --head HEAD >actual &&
+ test_cmp expect actual
+'
+
test_done
--
2.11.0
^ permalink raw reply related
* Re: [PATCH/TOY] Shortcuts to quickly refer to a commit name with keyboard
From: Jeff King @ 2017-01-20 16:09 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy; +Cc: git
In-Reply-To: <20170120102249.15572-1-pclouds@gmail.com>
On Fri, Jan 20, 2017 at 05:22:49PM +0700, Nguyễn Thái Ngọc Duy wrote:
> OK This patch is horrible. Though the idea is cool and I've found it
> very useful. So here it is. Perhaps the idea may be revised a bit
> that's more suitable for more than one user.
>
> The problem is old, SHA-1 name is not keyboard-friendly, even in
> abbreviated form. And recent change has made abbrev form longer,
> harder to type. Most of the time I just go with copy/paste with the
> mouse, which I don't like. name-rev helps a bit, but it's still long
> to type (especially with all the ^ and ~ that requires holding shift
> down).
Not really a comment on your patch itself, but I think a lot of people
solve this at a higher level, either in their terminal or via a tool
like tmux.
I recently taught urxvt to recognize sha1s and grab them via keyboard
hints, and I'm finding it quite useful. Here's what it looks like if
you're interested:
http://peff.net/git-hints.gif
The hints technique is taken from pentadactyl (which I also use), but
the urxvt port is mine. I'm happy to share the code.
Which isn't to say solving it inside Git is wrong, but I've found it
really convenient for two reasons:
1. It works whenever you see a sha1, not just in git commands (so
emails, inside commit messages, etc).
2. It doesn't take any screen space until you're ready to select.
The big downside is that it's scraping the screen, so you're guessing at
what is a sha1. False positives are a little annoying, but usually not
that big a deal because you're already looking at what you want to
select, and the hint pops up right there.
-Peff
^ permalink raw reply
* Re: fatal: bad revision 'git rm -r --ignore-unmatch -- folder'
From: jean-christophe manciot @ 2017-01-20 15:24 UTC (permalink / raw)
To: git
In-Reply-To: <CAKcFC3ZYwrVfEZ2Xua1kpQVeOMKY-wM=oce9JQhz4Tnookf8Dg@mail.gmail.com>
I've finally found the correct command after some significant research:
git filter-branch --tag-name-filter cat --index-filter "git rm -r
--cached --ignore-unmatch ${file_path}/${file_name}" --prune-empty
--force -- --all
On Fri, Jan 20, 2017 at 4:23 PM, jean-christophe manciot
<actionmystique@gmail.com> wrote:
> I've finally found the correct command after some significant research:
> git filter-branch --tag-name-filter cat --index-filter "git rm -r --cached
> --ignore-unmatch ${file_path}/${file_name}" --prune-empty --force -- --all
>
> On Thu, Jan 19, 2017 at 9:42 AM, jean-christophe manciot
> <actionmystique@gmail.com> wrote:
>>
>> Also some context information:
>> Ubuntu 16.10 4.8
>> git 2.11.0
>>
>> On Thu, Jan 19, 2017 at 9:32 AM, jean-christophe manciot
>> <actionmystique@gmail.com> wrote:
>> > In case you were wondering whether these files were tracked or not:
>> >
>> > git-Games# git ls-files Ubuntu/16.04
>> > Ubuntu/16.04/residualvm_0.3.0~git-1_amd64.deb
>> > Ubuntu/16.04/scummvm-data_1.8.0_all.deb
>> > Ubuntu/16.04/scummvm-data_1.9.0_all.deb
>> > Ubuntu/16.04/scummvm-dbgsym_1.8.2~git20160821.bad86050_amd64.deb
>> > Ubuntu/16.04/scummvm-dbgsym_1.9.0_amd64.deb
>> > Ubuntu/16.04/scummvm_1.8.0_amd64.deb
>> > Ubuntu/16.04/scummvm_1.9.0_amd64.deb
>> >
>> > On Tue, Jan 17, 2017 at 4:30 PM, jean-christophe manciot
>> > <actionmystique@gmail.com> wrote:
>> >> Hi there,
>> >>
>> >> I'm trying to purge a complete folder and its files from the
>> >> repository history with:
>> >>
>> >> git-Games# git filter-branch 'git rm -r --ignore-unmatch --
>> >> Ubuntu/16.04/' --tag-name-filter cat -- --all HEAD
>> >> fatal: bad revision 'git rm -r --ignore-unmatch -- Ubuntu/16.04/'
>> >>
>> >> git does not find the folder although it's there:
>> >>
>> >> git-Games# ll Ubuntu/16.04/
>> >> total 150316
>> >> drwxr-x--- 2 actionmystique actionmystique 4096 Nov 19 13:40 ./
>> >> drwxr-x--- 4 actionmystique actionmystique 4096 Oct 30 14:02 ../
>> >> -rwxr-x--- 1 actionmystique actionmystique 2190394 May 9 2016
>> >> residualvm_0.3.0~git-1_amd64.deb*
>> >> ...
>> >> -rw-r--r-- 1 actionmystique actionmystique 67382492 Oct 13 09:15
>> >> scummvm-dbgsym_1.9.0_amd64.deb
>> >>
>> >> What is going on?
>> >>
>> >> --
>> >> Jean-Christophe
>> >
>> >
>> >
>> > --
>> > Jean-Christophe
>>
>>
>>
>> --
>> Jean-Christophe
>
>
>
>
> --
> Jean-Christophe
--
Jean-Christophe
^ permalink raw reply
* Re: [RFC] stash --continue
From: Johannes Schindelin @ 2017-01-20 15:27 UTC (permalink / raw)
To: Marc Branchaud; +Cc: Stephan Beyer, git
In-Reply-To: <1fba12e3-78f0-6b2f-31ca-8d888744b9aa@xiplink.com>
Hi Marc,
On Fri, 20 Jan 2017, Marc Branchaud wrote:
> On 2017-01-19 04:30 PM, Johannes Schindelin wrote:
> >
> > At this point I will stop commenting on this issue, as I have said all
> > that I wanted to say about it, at least once. If I failed to get my
> > points across so far, I simply won't be understood.
>
> Yes, we're obviously looking at this from completely different
> perspectives.
Yes, but you claim to argue from the users' perspective, while I actually
work with enough users to be really certain that I described their mental
model of what an operation is very accurately.
> Stephan (or whoever) if you decide to do this work, I will be content
> with whichever way you choose to go.
So you only wanted to argue and not actually do anything? Tsk, tsk...
:-)
Ciao,
Johannes
^ permalink raw reply
* Re: [PATCH/TOY] Shortcuts to quickly refer to a commit name with keyboard
From: Johannes Schindelin @ 2017-01-20 15:21 UTC (permalink / raw)
To: Duy Nguyen; +Cc: Git Mailing List
In-Reply-To: <CACsJy8C0SFsTNTB=R8zLLvnqkPofP0VQWPUR9pguT-n2Y+Tp1w@mail.gmail.com>
Hi Duy,
On Fri, 20 Jan 2017, Duy Nguyen wrote:
> On Fri, Jan 20, 2017 at 5:46 PM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> > Why not introduce a flag to "git log" that shows a keyboard-friendly name
> > similar to what `git name-rev` would have said, except that the name would
> > be generated using the name(s) specified on the command-line?
> >
> > Example:
> >
> > git log 8923d2d0 upstream/pu
> >
> > commit 8923d2d00192ceb1107078484cccf537cb51c1b5 (8923d2d0)
> > ...
> > commit 9f500d6cf5eaa49391d6deca85fc864e5bd23415 (8923d2d0^)
> > ...
> > commit f79c24a291a58845b08cfec7573e22cc153693e1 (8923d2d0~2)
> > ...
> > commit c921c5bb63baaa16dc760de9549da55c8c89dc9c (upstream/pu)
> > ...
> > commit 16793ba6b6333ba0cdee1adb53d979c3fbdb17bc (upstream/pu^)
> > ...
> >
> > Granted, this is still a little more cumbersome to type than @h1, but
> > then, you can skip those round-robin games as well as the possibly
> > backwards-incompatible extension of the rev syntax.
>
> I mentioned name-rev a few paragraphs down.
Okay, then.
> No, I want the sweet and short @h1 (or something like that). name-rev
> does not qualify.
I am afraid that you have to go back to the drawing board, then, to come
up with a backwards-compatible syntax that is as equally short and sweet
as @h1.
And you will probably also have to come up with a strategy for
implementing "transient refs", because that is exactly what you are doing
here. After all, you need to ensure that @h1 still works correctly (i.e.
without scary warnings) when the corresponding ref has been removed and an
aggressive garbage collection was completed.
And there are other concerns to be considered, not only the
backwards-compatibility. Certainly the current design will need to be
overhauled.
Just from a cursory brain-storming on my side (I even left out the
hand-waving concerns):
- this feature requires write-access. From a user's point of view, this
should be read-only, or at least also work without write access
- the term "commit mark" is already used for something very different in
fast-import
- the idea that running "git log --mark-commits master" twice will
generate *different* marks is surprising (and not in a good way)
- introducing a feature to save keyboard strokes, and then requiring the
user to type ` --mark-commits`, i.e. 15 key presses, is, uhm, funny
- the fact that these marks are per-worktree makes it a lot less useful
than if they were per-repository
- related: there is no way to re-use these marks in different
repositories, e.g. when helping other developers, say, in a chat room
- the fact that the first mark in every repository will be @a1 opens the
door very wide for using that mark accidentally in the wrong repository.
At least if I write 8923d in the git-gui repository, it will tell me
that there is no such revision. Using @a1, it would succeed, and it
would take me a *long* time to even realize that I am in the wrong
directory!
And then there are the implementation issues:
- it uses symlinks. I cannot let you do that, Dave.
- using sscanf() to get the value of the first byte of a buffer? What's
wrong with `*buf*`?
- "asdfghjk"? That is *very* limiting. The opposite of diverse. Just ask
the French, for starters
- latest_fd is never closed, nor flushed
It sure complicates the implementation side as well as the overall design
a heck of a lot to insist on not using existing rev syntax.
> I don't feel comfortable typing 8923d2d0 without looking at the
> keyboard, and that's a lot of movement on the keyboard.
I mentioned 8923d2d0 only as an example to illustrate the difference to
name-rev.
And when you talk about movement on the keyboard, you *must* realize that
you impose your favorite keyboard layout here. On the German keyboard, for
example, the `@` sign is typed via AltGr+q. That is very cumbersome right
there.
And when you talk about speed advantages of keyboard vs mouse, it seems
that there are studies that show that keyboard is faster than mouse. For
keyboard shortcuts. Not for typing. I actually found no study comparing
the speed of typing with the speed of copy/paste, although I am sure that
they exist, and that they show pretty clearly that copy/paste is faster,
and more accurate, than typing.
But back to minimizing movement on the keyboard.
You would usually type `git log upstream/pu`, tab-completing
`upstream/pu`, right? And then you would want to refer to one particular
entry in that output, say, `upstream/pu~50^2`, right?
Right:
> upstream/pu is a bit better, but still very long (at least for me). Yes
> TAB-ing does help, but not enough. Then you'll get the dreadful "^2~1^3"
> dance.
Yes, exactly. You would use tab-completion there, too, most of the way.
Although I do not find that "^2^^3" [*1*] dreadful, I can see that some
users find it cumbersome. And then it is a little bit over the top to try
to optimize away that "^2^^3".
However, I am starting to feel like you try to use the wrong approach,
bending Git's user interface out of shape just to be able force a workflow
that avoids copy-paste or GUIs, or for that matter, advanced ref notation
such as "upstream/pu^{/worktree.remove}".
Don't get me wrong, I would love to have faster method to go between log
and prompt. But to be honest, what costs me much more of my time is
figuring out which commit and branch any given mail talks about when
reviewing, or addressing reviews. Or for that matter, finding the mail
thread discussing the patch series that the "What's cooking" mail talks
about. I guess I'd spend more time on accelerating that than on avoiding
copy/paste from `git log`'s output.
Ciao,
Johannes
Footnote *1*: Do we really have octopus merges in Git? I do not think so.
*clicketyclick*. Urgh. You are correct. I found a whopping 45 in my
repository, and I certainly did not introduce any. On a sunny note, the
last Octopus seems to be v1.7.10-rc0~9^2~9(Merge branches
zj/decimal-width, zj/term-columns and jc/diff-stat-scaler, 2012-02-24),
i.e. a couple of years old.
^ permalink raw reply
* Re: [RFC] stash --continue
From: Marc Branchaud @ 2017-01-20 15:19 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Stephan Beyer, git
In-Reply-To: <alpine.DEB.2.20.1701192220320.3469@virtualbox>
On 2017-01-19 04:30 PM, Johannes Schindelin wrote:
>
> At this point I will stop commenting on this issue, as I have said all
> that I wanted to say about it, at least once. If I failed to get my points
> across so far, I simply won't be understood.
Yes, we're obviously looking at this from completely different perspectives.
Stephan (or whoever) if you decide to do this work, I will be content
with whichever way you choose to go.
M.
^ permalink raw reply
* Re: [RFC 0/2] grep: make output consistent with revision syntax
From: Jeff King @ 2017-01-20 14:32 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: git, gitster
In-Reply-To: <20170120141832.GE17499@stefanha-x1.localdomain>
On Fri, Jan 20, 2017 at 02:18:32PM +0000, Stefan Hajnoczi wrote:
> > Are there cases you know that aren't covered by your patches?
>
> From Patch 2/2:
>
> This patch does not cope with @{1979-02-26 18:30:00} syntax and treats
> it as a path because it contains colons.
>
> If we use obj->type instead of re-parsing the name then that problem is
> solved.
Ah, right. I somehow totally missed that, and blindly assumed your colon
search was only at the end. But of course that wouldn't work at all (it
would miss "v2.9.3:t").
So yes, definitely it should be checking the object type.
-Peff
^ permalink raw reply
* Re: [PATCH] log: new option decorate reflog of remote refs
From: Jeff King @ 2017-01-20 14:30 UTC (permalink / raw)
To: Duy Nguyen; +Cc: Git Mailing List
In-Reply-To: <CACsJy8A_LkRMZYfoJuYEUok4r7Tw0VuMwVkG_Kr1o1hFcAUWNw@mail.gmail.com>
On Fri, Jan 20, 2017 at 05:55:21PM +0700, Duy Nguyen wrote:
> > We already have very flexible ref-selectors like --remotes, --branches,
> > etc. The generalization of this would perhaps be something like:
> >
> > git log --decorate-reflog --remotes --branches
> >
> > where "--decorate-reflog" applies to the next ref selector and then is
> > reset, the same way --exclude is. And it includes those refs _only_ for
> > decoration, not for traversal. So you could do:
> >
> > git log --decorate-reflog --remotes --remotes
> >
> > if you wanted to see use those as traversal roots, too (if this is
> > common, it might even merit another option for "decorate and show").
> >
> > That's just off the top of my head, so maybe there are issues. I was
> > just surprised to see the "-remote" part in your option name.
>
> Imposing order between options could cause confusion, I think, if you
> remove --decorate-reflog leaving --remotes on by accident, now you get
> --remotes with a new meaning. We could go with something like
> --decodate-reflog=remote, but that clashes with the number of reflog
> entries and we may need a separator, like --decorate-reflog=remote,3.
> Or we could add something to --decorate= in addition to
> short|full|auto|no. Something like --decorate=full,reflog or
> --decorate=full,reflog=remote,entries=3 if I want 3 reflog entries.
I agree that making option-order important is potentially confusing. But
it does already exist with --exclude. It's necessary to specify some
sets of refs (e.g., all of A, except for those that match B, and then
all of C, including those that match B).
Having --decorate-reflog=remote would be similarly constrained. You
couldn't do "decorate all remotes except for these ones". For that
matter, I'm not sure how you would do "decorate just the refs from
origin".
I'll grant that those are going to be a lot less common than just "all
the remotes" (or all the tags, or whatever). I'd just hate to see us
revisiting this in a year to generalize it, and being stuck with
historical baggage.
> My hesitant to go that far is because I suspect decorating reflog
> won't be helpful for non-remotes. But I'm willing to make more changes
> if it opens door to master.
Forgetting reflogs for a moment, I'd actually find it useful to just
decorate tags and local branches, but not remotes. But right now there
isn't any way to select which refs are worthy of decoration (reflog or
not).
That's why I'm thinking so much about a general ref-selection system. I
agree the "--exclude=... --remotes" thing is complicated, but it's also
the ref-selection system we _already_ have, which to me is a slight
point in its favor.
-Peff
^ permalink raw reply
* Re: [RFC 2/2] grep: use '/' delimiter for paths
From: Jeff King @ 2017-01-20 14:19 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: Junio C Hamano, git
In-Reply-To: <20170120141212.GC17499@stefanha-x1.localdomain>
On Fri, Jan 20, 2017 at 02:12:12PM +0000, Stefan Hajnoczi wrote:
> I find <rev>:<path> vs <rev> -- <path> confusing:
>
> | <rev>:<path> | <rev> -- <path>
> ----------+----------------------+---------------------
> git grep | OK | OK
> ----------+----------------------+---------------------
> git show | OK | <path> ignored
> ----------+----------------------+---------------------
> git log | no output | OK
> ----------+----------------------+---------------------
>
> Neither syntax always does what I expect. If git show <rev> -- <path>
> honored <path> then I could use that syntax consistently.
>
> Sorry for going on a tangent. Does it seem reasonable to handle <path>
> in git-show(1) as a UI convenience?
It's not ignored; just as with git-log, it's a pathspec to limit the
diff. E.g.:
$ git show --name-status v2.9.3
...
M Documentation/RelNotes/2.9.3.txt
M Documentation/git.txt
M GIT-VERSION-GEN
$ git show --name-status v2.9.3 -- Documentation
M Documentation/RelNotes/2.9.3.txt
M Documentation/git.txt
That's typically less useful than it is with log (where limiting the
diff also kicks in history simplification and omits some commits
entirely). But it does do something.
-Peff
^ permalink raw reply
* Re: [RFC 0/2] grep: make output consistent with revision syntax
From: Stefan Hajnoczi @ 2017-01-20 14:18 UTC (permalink / raw)
To: Jeff King; +Cc: git, gitster
In-Reply-To: <20170119165958.xtotlvdta7udqllb@sigill.intra.peff.net>
[-- Attachment #1: Type: text/plain, Size: 1377 bytes --]
On Thu, Jan 19, 2017 at 11:59:59AM -0500, Jeff King wrote:
> On Thu, Jan 19, 2017 at 03:03:45PM +0000, Stefan Hajnoczi wrote:
>
> > git-grep(1)'s output is not consistent with git-rev-parse(1) revision syntax.
> >
> > This means you cannot take "rev:path/to/file.c: foo();" output from git-grep(1)
> > and expect "git show rev:path/to/file.c" to work. See the individual patches
> > for examples of command-lines that produce invalid output.
>
> I think this is a good goal.
>
> I couldn't immediately think of any cases where your patches would
> misbehave, but my initial thought was that the "/" versus ":"
> distinction is about whether the initial object is a tree or a commit.
>
> You do still have to special case the root tree (so "v2.9.3:" does not
> get any delimiter). I think "ends in a colon" is actually a reasonable
> way of determining that.
>
> > This series is an incomplete attempt at solving the issue. I'm not familiar
> > enough with the git codebase to propose a better solution. Perhaps someone is
> > interested in a proper fix?
>
> Are there cases you know that aren't covered by your patches?
From Patch 2/2:
This patch does not cope with @{1979-02-26 18:30:00} syntax and treats
it as a path because it contains colons.
If we use obj->type instead of re-parsing the name then that problem is
solved.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply
* Re: [RFC 2/2] grep: use '/' delimiter for paths
From: Stefan Hajnoczi @ 2017-01-20 14:17 UTC (permalink / raw)
To: Brandon Williams; +Cc: git, gitster
In-Reply-To: <20170119182934.GH10641@google.com>
[-- Attachment #1: Type: text/plain, Size: 2172 bytes --]
On Thu, Jan 19, 2017 at 10:29:34AM -0800, Brandon Williams wrote:
> On 01/19, Stefan Hajnoczi wrote:
> > If the tree contains a sub-directory then git-grep(1) output contains a
> > colon character instead of a path separator:
> >
> > $ git grep malloc v2.9.3:t
> > v2.9.3:t:test-lib.sh: setup_malloc_check () {
> > $ git show v2.9.3:t:test-lib.sh
> > fatal: Path 't:test-lib.sh' does not exist in 'v2.9.3'
> >
> > This patch attempts to use the correct delimiter:
> >
> > $ git grep malloc v2.9.3:t
> > v2.9.3:t/test-lib.sh: setup_malloc_check () {
> > $ git show v2.9.3:t/test-lib.sh
> > (success)
> >
> > This patch does not cope with @{1979-02-26 18:30:00} syntax and treats
> > it as a path because it contains colons.
> >
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> > ---
> > builtin/grep.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/builtin/grep.c b/builtin/grep.c
> > index 3643d8a..06f8b47 100644
> > --- a/builtin/grep.c
> > +++ b/builtin/grep.c
> > @@ -493,7 +493,8 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
> >
> > /* Add a delimiter if there isn't one already */
> > if (name[len - 1] != '/' && name[len - 1] != ':') {
> > - strbuf_addch(&base, ':');
> > + /* rev: or rev:path/ */
> > + strbuf_addch(&base, strchr(name, ':') ? '/' : ':');
>
> As Jeff mentioned it may be better to base which character gets appended
> by checking the obj->type field like this maybe:
>
> diff --git a/builtin/grep.c b/builtin/grep.c
> index 69dab5dc5..9dfe11dc7 100644
> --- a/builtin/grep.c
> +++ b/builtin/grep.c
> @@ -495,7 +495,8 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
> /* Add a delimiter if there isn't one already */
> if (name[len - 1] != '/' && name[len - 1] != ':') {
> /* rev: or rev:path/ */
> - strbuf_addch(&base, strchr(name, ':') ? '/' : ':');
> + char del = obj->type == OBJ_COMMIT ? ':' : '/';
> + strbuf_addch(&base, del);
Nice, that also solves the false positive with @{1979-02-26 18:30:00}.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply
* Re: [RFC 2/2] grep: use '/' delimiter for paths
From: Stefan Hajnoczi @ 2017-01-20 14:12 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <xmqqpoji2851.fsf@gitster.mtv.corp.google.com>
[-- Attachment #1: Type: text/plain, Size: 2219 bytes --]
On Thu, Jan 19, 2017 at 10:54:02AM -0800, Junio C Hamano wrote:
> Stefan Hajnoczi <stefanha@redhat.com> writes:
>
> > If the tree contains a sub-directory then git-grep(1) output contains a
> > colon character instead of a path separator:
> >
> > $ git grep malloc v2.9.3:t
> > v2.9.3:t:test-lib.sh: setup_malloc_check () {
> > $ git show v2.9.3:t:test-lib.sh
> > fatal: Path 't:test-lib.sh' does not exist in 'v2.9.3'
>
> I am slightly less negative on this compared to 1/2, but not by a
> big margin. The user wanted to feed a subtree to the command,
> instead of doing the more natural
>
> $ git grep -e malloc v2.9.3 -- t
I find <rev>:<path> vs <rev> -- <path> confusing:
| <rev>:<path> | <rev> -- <path>
----------+----------------------+---------------------
git grep | OK | OK
----------+----------------------+---------------------
git show | OK | <path> ignored
----------+----------------------+---------------------
git log | no output | OK
----------+----------------------+---------------------
Neither syntax always does what I expect. If git show <rev> -- <path>
honored <path> then I could use that syntax consistently.
Sorry for going on a tangent. Does it seem reasonable to handle <path>
in git-show(1) as a UI convenience?
> So again, "contains a colon character" is not coming from what Git
> does, but the user gave Git "a colon character" when she didn't have
> to.
>
> Having said that, if we wanted to start ignoring what the end-user
> said in the initial input like 1/2 and 2/2 does (i.e. "this specific
> tree object" as an input), I think the approach to solve for 1/2 and
> 2/2 should be the same. I think we should decide to do a slash
> instead of a colon, not because v2.9.3: has colon at the end and
> v2.9.3:t has colon in it, but because both of these are both bare
> tree objects. The patches presented does not seem to base their
> decision on the actual object type but on the textual input, which
> seems wrong.
Yes, reparsing the name is ugly and I hoped to get feedback with this
RFC. Thanks for the quick review!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply
* Re: [RFC 1/2] grep: only add delimiter if there isn't one already
From: Stefan Hajnoczi @ 2017-01-20 13:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <xmqqtw8u28u1.fsf@gitster.mtv.corp.google.com>
[-- Attachment #1: Type: text/plain, Size: 1751 bytes --]
On Thu, Jan 19, 2017 at 10:39:02AM -0800, Junio C Hamano wrote:
> Stefan Hajnoczi <stefanha@redhat.com> writes:
>
> > git-grep(1) output does not follow git's own syntax:
> >
> > $ git grep malloc v2.9.3:
> > v2.9.3::Makefile: COMPAT_CFLAGS += -Icompat/nedmalloc
> > $ git show v2.9.3::Makefile
> > fatal: Path ':Makefile' does not exist in 'v2.9.3'
> >
> > This patch avoids emitting the unnecessary ':' delimiter if the name
> > already ends with ':' or '/':
> >
> > $ git grep malloc v2.9.3:
> > v2.9.3:Makefile: COMPAT_CFLAGS += -Icompat/nedmalloc
> > $ git show v2.9.3:Makefile
> > (succeeds)
>
> I am mildly negative on this one. I suspect that the above example
> is a made-up one and you might have a more compelling real-world use
> case in mind, but at least the above does not convince me.
Another trailing delimiter example:
$ git grep malloc v2.9.3:t/
v2.9.3:t/:test-lib.sh: setup_malloc_check () {
After Patch 1/2:
v2.9.3:t/test-lib.sh: setup_malloc_check () {
> The end-user explicitly gave the extra ':' because she wanted to
> feed the tree object, not a tag that leads to the tree, for some
> reason. I think the output should respect that and show how she
> spelled the starting point. IOW, it is not "':' added unnecessarily
> by Git". It is ':' added by the end-user for whatever reason.
v2.9.3::Makefile may convey that the user originally provided v2.9.3:
but is that actually useful information? I don't see what the user will
do with this information (and they should already know since they
provided the command-line).
v2.9.3:Makefile can be copy-pasted or extracted by scripts for further
git commands. That is useful.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply
* Re: [RFC PATCH 0/5] Localise error headers
From: Duy Nguyen @ 2017-01-20 13:31 UTC (permalink / raw)
To: Jeff King; +Cc: Stefan Beller, Michael J Gruber, git@vger.kernel.org
In-Reply-To: <20170120132322.GA23030@ash>
On Fri, Jan 20, 2017 at 8:23 PM, Duy Nguyen <pclouds@gmail.com> wrote:
> I've tested it a bit. Seems to work ok.
Oops. Didn't notice that the "fatal:" bit is still untranslated but
Micheal's patch can handle that.
--
Duy
^ permalink raw reply
* Re: [PATCH] git-prompt.sh: add submodule indicator
From: SZEDER Gábor @ 2017-01-20 13:35 UTC (permalink / raw)
To: Benjamin Fuchs; +Cc: Stefan Beller, git, felipe.contreras, ville.skytta
In-Reply-To: <1484870858-6336-1-git-send-email-email@benjaminfuchs.de>
I'm not well-versed in submodules, so I won't comment on whether this
is the right way to determine that a repository is a submodule, but I
was surprised to see how much you have to work to find this out.
My comments will mostly focus on how to eliminate or at least limit
the scope of subshells and command executions, because fork()s and
exec()s are rather expensive on Windows.
On Fri, Jan 20, 2017 at 1:07 AM, Benjamin Fuchs <email@benjaminfuchs.de> wrote:
> I expirienced that working with submodules can be confusing. This indicator
> will make you notice very easy when you switch into a submodule.
> The new prompt will look like this: (sub:master)
> Adding a new optional env variable for the new feature.
>
> Signed-off-by: Benjamin Fuchs <email@benjaminfuchs.de>
> ---
> contrib/completion/git-prompt.sh | 37 ++++++++++++++++++++++++++++++++++++-
> 1 file changed, 36 insertions(+), 1 deletion(-)
Tests?
> diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
> index 97eacd7..4c82e7f 100644
> --- a/contrib/completion/git-prompt.sh
> +++ b/contrib/completion/git-prompt.sh
> @@ -93,6 +93,10 @@
> # directory is set up to be ignored by git, then set
> # GIT_PS1_HIDE_IF_PWD_IGNORED to a nonempty value. Override this on the
> # repository level by setting bash.hideIfPwdIgnored to "false".
> +#
> +# If you would like __git_ps1 to indicate that you are in a submodule,
> +# set GIT_PS1_SHOWSUBMODULE. In this case a "sub:" will be added before
> +# the branch name.
>
> # check whether printf supports -v
> __git_printf_supports_v=
> @@ -284,6 +288,32 @@ __git_eread ()
> test -r "$f" && read "$@" <"$f"
> }
>
> +# __git_is_submodule
> +# Based on:
> +# http://stackoverflow.com/questions/7359204/git-command-line-know-if-in-submodule
> +__git_is_submodule ()
Use the '__git_ps1' prefix in the function name, like the other
functions.
> +{
> + local git_dir parent_git module_name path
> + # Find the root of this git repo, then check if its parent dir is also a repo
> + git_dir="$(git rev-parse --show-toplevel)"
1. This is a somewhat misleading variable name, because git_dir (with
or without underscore or dash) refers to the path to the .git
directory of a repository through the codebase, documentation and
CLI options, not the top-level directory of the worktree.
2. In a bare repository or in the .git directory of a "regular"
repository '--show-toplevel' doesn't output anything, leading to
an empty $module_name below, which ultimately results in no
submodule indicator.
As fas as behavior is concerned, this is good in the bare
repository case, because as I understand it there is no such thing
as a bare submodule. I'm not sure whether the submodule indicator
should be displayed in the ".git dir of a submodule" case. I
leave it up to you and Stefan to discuss.
However, the info about whether we are in a bare repository or
.git dir is already availabe in certain variables, so we know
upfront when the current repository can't be a submodule. In
those cases this function should not be called only to spend
several subshells and command executions to figure out what we
already knew anyway.
3. The path to the .git directory of the current repository
is already available in the (not particularly descriptively named)
$g variable from __git_ps1. Perhaps you could use that variable
instead, thus avoiding a subshell and executing a git command
here.
> + module_name="$(basename "$git_dir")"
This is executed even when there is no repository in the parent
directories, but it's only needed when there _is_ a repo up there.
Please move it into the conditional below, to avoid a subshell and
command execution in the main code path.
Since this $git_dir comes directly from our own 'git rev-parse' do we
have to be prepared for a Windows-style path there? If it were always
a UNIX-style path, then we could strip all directories with shell
parameter expansion, eliminating both the subshell and the basename
execution.
> + parent_git="$(cd "$git_dir/.." && git rev-parse --show-toplevel 2> /dev/null)"
Style nit: no space after redirection, i.e. it should be '2>/dev/null'.
More importantly, I don't think you really need this variable:
1. The existence of a parent git repository can be determined from
'git rev-parse's exit code alone.
2. When you run 'git submodule' below, you don't have to cd to the
_top-level_ directory of the parent repository's worktree. You
just have to cd to _any_ directory in the parent, and you can do
that with 'git -C "$git_dir/.." submodule ...', without knowing
the parent's top-level directory.
This means that you don't need 'git rev-parse's output, thus there is
no need for the command substitution. Yet another subshell spared! :)
However, then you have to be careful with changing directories, and
should write it as 'git -C "$git_dir/.." rev-parse ...'.
> + if [[ -n $parent_git ]]; then
Unquoted path.
> + # List all the submodule paths for the parent repo
> + while read path
> + do
> + if [[ "$path" != "$module_name" ]]; then continue; fi
> + if [[ -d "$git_dir/../$path" ]]; then return 0; fi
> + done < <(cd $parent_git && git submodule --quiet foreach 'echo $path' 2> /dev/null)
Unquoted path and space after redirection again.
This loop will get confused if one of the submodule paths contains a
newline, though probably no one in their right mind would do something
like that. Is it even possible to have a submodule name with newline
in it?
I wonder whether it would be possible to move the conditions from the
loop body to the shell command evaluated by 'submodule foreach', thus
eliminating the loop entirely and making submodule detection
newline-safe. Or whether it's worth the trouble...
> + fi
> + return 1
Indent with spaces, please use tabs instead.
> +}
> +
> +__git_ps1_submodule ()
> +{
> + __git_is_submodule && printf "sub:"
> +}
This function is unnecessary.
First, it's so short that it's body can be safely inlined in its
caller. Second, it _prints_ its output to stdout, forcing the
caller to use a command substitution. You can simply assign the value
to $sub based on __git_ps1_is_submodule()'s return value.
> +
> # __git_ps1 accepts 0 or 1 arguments (i.e., format string)
> # when called from PS1 using command substitution
> # in this mode it prints text to add to bash PS1 prompt (includes branch name)
> @@ -513,8 +543,13 @@ __git_ps1 ()
> b="\${__git_ps1_branch_name}"
> fi
>
> + local sub=""
Thank you for _not_ introducing yet another one letter variable name
:)
> + if [ -n "${GIT_PS1_SHOWSUBMODULE}" ]; then
> + sub="$(__git_ps1_submodule)"
> + fi
> +
> local f="$w$i$s$u"
> - local gitstring="$c$b${f:+$z$f}$r$p"
> + local gitstring="$c$sub$b${f:+$z$f}$r$p"
>
> if [ $pcmode = yes ]; then
> if [ "${__git_printf_supports_v-}" != yes ]; then
> --
> 2.7.4
>
^ permalink raw reply
* Re: [RFC PATCH 0/5] Localise error headers
From: Duy Nguyen @ 2017-01-20 13:23 UTC (permalink / raw)
To: Jeff King; +Cc: Stefan Beller, Michael J Gruber, git@vger.kernel.org
In-Reply-To: <20170111113725.avl3wetwrfezdni2@sigill.intra.peff.net>
On Wed, Jan 11, 2017 at 06:37:25AM -0500, Jeff King wrote:
> > To find a good example, "git grep die" giving me some food of though:
> >
> > die_errno(..) should always take a string marked up for translation,
> > because the errno string is translated?
>
> Yes, I would think die_errno() is a no-brainer for translation, since
> the strerror() will be translated.
I agree. And the main (*) changes are relative simple too. I've tested
it a bit. Seems to work ok.
-- 8< --
diff --git a/Makefile b/Makefile
index d861bd9985..6f88c6cac5 100644
--- a/Makefile
+++ b/Makefile
@@ -2102,7 +2102,7 @@ XGETTEXT_FLAGS = \
--msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
--from-code=UTF-8
XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
- --keyword=_ --keyword=N_ --keyword="Q_:1,2"
+ --keyword=_ --keyword=N_ --keyword="Q_:1,2" --keyword=die_errno
XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
--keyword=gettextln --keyword=eval_gettextln
XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
diff --git a/usage.c b/usage.c
index 17f52c1b5c..c022726f9c 100644
--- a/usage.c
+++ b/usage.c
@@ -159,7 +159,7 @@ void NORETURN die_errno(const char *fmt, ...)
}
va_start(params, fmt);
- die_routine(fmt_with_err(buf, sizeof(buf), fmt), params);
+ die_routine(fmt_with_err(buf, sizeof(buf), _(fmt)), params);
va_end(params);
}
-- 8< --
(*) We would need another patch to remove _() from die_errno(_(..)).
But that's something I expect coccinelle to be excel at.
--
Duy
^ permalink raw reply related
* Re: [RFC PATCH 0/5] Localise error headers
From: Duy Nguyen @ 2017-01-20 13:08 UTC (permalink / raw)
To: Junio C Hamano
Cc: Jeff King, Stefan Beller, Michael J Gruber, git@vger.kernel.org
In-Reply-To: <xmqq1sw9piz5.fsf@gitster.mtv.corp.google.com>
On Thu, Jan 12, 2017 at 1:08 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Jeff King <peff@peff.net> writes:
>
>> Yes, I would think die_errno() is a no-brainer for translation, since
>> the strerror() will be translated.
>>
>>> apply.c: die(_("internal error"));
>>>
>>> That is funny, too. I think we should substitute that with
>>>
>>> die("BUG: untranslated, but what went wrong instead")
>>
>> Yep. We did not consistently use "BUG:" in the early days. I would say
>> that "BUG" lines do not need to be translated. The point is that nobody
>> should ever see them, so it seems like there is little point in giving
>> extra work to translators.
>
> In addition, "BUG: " is relatively recent introduction to our
> codebase. Perhaps having a separate BUG(<string>) function help the
> distinction further?
I was going to write the same thing. On top of that I wonder if have
enough "if (something) die("BUG:")" to justify stealing BUG_ON() from
kernel (better than assert since the condition will always be
evaluated).
--
Duy
^ permalink raw reply
* Re: merge maintaining history
From: Jakub Narębski @ 2017-01-20 11:37 UTC (permalink / raw)
To: Junio C Hamano, David J. Bakeman; +Cc: Jacob Keller, Git mailing list
In-Reply-To: <xmqq37gezpz8.fsf@gitster.mtv.corp.google.com>
W dniu 19.01.2017 o 22:42, Junio C Hamano pisze:
> "David J. Bakeman" <nakuru@comcast.net> writes:
[...]
>> Thanks I think that's close but it's a little more complicated I think
>> :<( I don't know if this diagram will work but lets try.
>>
>> original A->B->C->D->E->F
>> \
>> first branch b->c->d->e
>>
>> new repo e->f->g->h
>>
>> Now I need to merge h to F without loosing b through h hopefully. Yes e
>> was never merged back to the original repo and it's essentially gone now
>> so I can't just merge to F or can I?
>
> With the picture, I think you mean 'b' is forked from 'B' and the
> first branch built 3 more commits on top, leading to 'e'.
>
> You say "new repo" has 'e' thru 'h', and I take it to mean you
> started developing on top of the history that leads to 'e' you built
> in the first branch, and "new repo" has the resulting history that
> leads to 'h'.
>
> Unless you did something exotic and non-standard, commit 'e' in "new
> repo" would be exactly the same as 'e' sitting on the tip of the
> "first branch", so the picture would be more like:
>
>> original A->B->C->D->E->F
>> \
>> first branch b->c->d->e
>> \
>> new repo f->g->h
>
> no?
On the other hand Git has you covered even if you did something
non-standard, like starting new repo from the _state_ of 'e', that
is you have just copied files and created new repository, having
'e' (or actually 'e*') as an initial commit.
original A<-B<-C<-D<-E<-F
\
first branch b<-c<-d<-e
new repo e*<-f<-g<-h
Note that arrows are in reverse direction, as it is newer commit
pointing to its parents, not vice versa.
Assuming that you have everything in a single repository, by adding
both original and new repo as "remotes", you can use 'git replace'
command to replace 'e*' with 'e'.
original A<-B<-C<-D<-E<-F
\
first branch b<-c<-d<-e
\
new repo \-f<-g<-h
(with refs/replace)
> Then merging 'h' into 'F' will pull everything you did since
> you diverged from the history that leads to 'F', resulting in a
> history of this shape:
>
>> original A->B->C->D->E->F----------M
>> \ /
>> first branch b->c->d->e /
>> \ /
>> new repo f->g->h
Then you would have the above history in repositories that fetched
refs/replace/*, and the one below if replacement info is absent:
original A<-B<-C<-D<-E<-F<-----------M
\ /
first branch b<-c<-d<-e /
/
new repo e*<-f->g->h
But as Junio said it is highly unlikely that you are in this situation.
HTH
--
Jakub Narębski
^ permalink raw reply
* Re: The design of refs backends, linked worktrees and submodules
From: Duy Nguyen @ 2017-01-20 11:22 UTC (permalink / raw)
To: Michael Haggerty; +Cc: Git Mailing List
In-Reply-To: <341999fc-4496-b974-c117-c18a2fca1358@alum.mit.edu>
On Thu, Jan 19, 2017 at 8:30 PM, Michael Haggerty <mhagger@alum.mit.edu> wrote:
> I kindof think that it would have been a better design to store the
> references for all linked worktrees in the main repository's ref-store.
> For example, the "bisect" refs for a worktree named "<name>" could have
> been stored under "refs/worktrees/<name>/bisect/*". Then either:
>
> * teach the associated tools to read/write references there directly
> (probably with DWIM rules to make command-line use easier), or
> * treat these references as if they were actually at a standard place
> like `refs/worktree/bisect/*`; i.e., users would need to know that they
> were per-worktree references, but wouldn't need to worry about the true
> locations, or
> * treat these references as if they were actually in their traditional
> locations (though it is not obvious how this scheme could be expanded to
> cover new per-worktree references).
Well. In one direction, we store everything at one place and construct
different slices of view of the unified store. On the other far end,
we have plenty of one-purpose stores, then combine them as we need.
It's probably personal taste, but I prefer the latter.
Making a single big store could bring us closer to the "big number"
problem. Yeah we will have to handle million of refs anyway, someday.
That does not mean we're free to increase the number of refs a few
more times. Then there are separate stores by nature like submodules
(caveat: I haven't checked out your submodule-hash branch), or the
problem with multiple repos sharing objects/info/alternates.
> This is a topic that I have thought a lot about. I definitely like this
> direction. In fact I've dabbled around with some first steps; see branch
> `submodule-hash` in my fork on GitHub [1]. That branch associates a
> `ref_store` more closely with the directory where the references are
> stored, as opposed to having a 1:1 relationship between `ref_store`s and
> submodules.
Thanks. Will check it out.
> Let me braindump some more information about this topic.
> ...
Juicy stuff :D It's hard to know these without staring really long and
hard at refs code. Thank you.
> I've taken some stabs at picking these apart into separate ref stores,
> but haven't had time to make very satisfying progress. By the time of
> GitMerge I might have a better feeling for whether I can devote some
> time to this project.
I think sending WIP patches to the list from time to time is also
helpful, even if it's not perfect. For one thing I would know you were
doing (or thinking at least, which also counts) and not stepping on
each other. On my part I'm not attempting to make any more changes (*)
until after I've read your branches.
(*) I took git_path() out of refs code and was surprised that multi
worktree broke. Silly me. Wrong first step.
--
Duy
^ permalink raw reply
* Re: Git: new feature suggestion
From: Jakub Narębski @ 2017-01-20 11:18 UTC (permalink / raw)
To: Linus Torvalds
Cc: Konstantin Khomoutov, Joao Pinto, Git Mailing List,
CARLOS.PALMINHA@synopsys.com
In-Reply-To: <CA+55aFz5Rnt8U3bpvgoHQSfjPrnxnMfWUGBbHW2XKiagKXga5w@mail.gmail.com>
W dniu 20.01.2017 o 01:26, Linus Torvalds pisze:
> On Thu, Jan 19, 2017 at 1:48 PM, Jakub Narębski <jnareb@gmail.com> wrote:
>> W dniu 19.01.2017 o 19:39, Linus Torvalds pisze:
>>>
>>> You can do it in tig, but I suspect a more graphical tool might be better.
>>
>> Well, we do have "git gui blame".
>
> Does that actually work for people? Because it really doesn't for me.
>
> And I'm not just talking about the aesthetics of the thing, but the
> whole experience, and the whole "dig into parent" which just gives me
> an error message.
Strange. I had been using "git gui blame" _because_ of its "dig to parent"
functionality, and it worked for me just fine.
The other thing that I like about "git gui blame" is that it shows both
the commit that moved the fragment of code (via "git blame"), and the
commit that created the fragment of code (via "git blame -C -C -w", I think).
Anyway, all of this (sub)discussion is about archeology, but what might
be more important is automatic rename handling when integrating changes,
be it git-am, git-merge, or something else...
--
Jakub Narębski
^ permalink raw reply
* Re: [PATCH/TOY] Shortcuts to quickly refer to a commit name with keyboard
From: Duy Nguyen @ 2017-01-20 11:01 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Git Mailing List
In-Reply-To: <alpine.DEB.2.20.1701201138520.3469@virtualbox>
On Fri, Jan 20, 2017 at 5:46 PM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Why not introduce a flag to "git log" that shows a keyboard-friendly name
> similar to what `git name-rev` would have said, except that the name would
> be generated using the name(s) specified on the command-line?
>
> Example:
>
> git log 8923d2d0 upstream/pu
>
> commit 8923d2d00192ceb1107078484cccf537cb51c1b5 (8923d2d0)
> ...
> commit 9f500d6cf5eaa49391d6deca85fc864e5bd23415 (8923d2d0^)
> ...
> commit f79c24a291a58845b08cfec7573e22cc153693e1 (8923d2d0~2)
> ...
> commit c921c5bb63baaa16dc760de9549da55c8c89dc9c (upstream/pu)
> ...
> commit 16793ba6b6333ba0cdee1adb53d979c3fbdb17bc (upstream/pu^)
> ...
>
> Granted, this is still a little more cumbersome to type than @h1, but
> then, you can skip those round-robin games as well as the possibly
> backwards-incompatible extension of the rev syntax.
I mentioned name-rev a few paragraphs down. No, I want the sweet and
short @h1 (or something like that). name-rev does not qualify. I don't
feel comfortable typing 8923d2d0 without looking at the keyboard, and
that's a lot of movement on the keyboard. upstream/pu is a bit
better, but still very long (at least for me). Yes TAB-ing does help,
but not enough. Then you'll get the dreadful "^2~1^3" dance.
--
Duy
^ 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