From: Michael J Gruber <hidden> Date: 2016-06-15 22:51:55
The documentation could be misunderstood as if "git replace -l" lists
the replacements of the specified objects. Currently, it lists the
replaced objects.
Change the output to the form "<object> <replacement>" so that there is
an easy way to find the replacement, besides the more difficult to find
git show-ref $(git replace -l).
Signed-off-by: Michael J Gruber <redacted>
---
Noted in passing while testing decorations.
---
Documentation/git-replace.txt | 2 +-
builtin/replace.c | 2 +-
t/t6050-replace.sh | 8 ++++----
3 files changed, 6 insertions(+), 6 deletions(-)
@@ -58,7 +58,7 @@ OPTIONS -l <pattern>:: List replace refs for objects that match the given pattern (or- all if no pattern is given).+ all if no pattern is given) in the form "<object> <replacement>". Typing "git replace" without arguments, also lists all replace refs.
@@ -119,10 +119,10 @@ test_expect_success 'repack, clone and fetch work' '' test_expect_success'"git replace" listing and deleting''-test"$HASH2"="$(gitreplace-l)"&&-test"$HASH2"="$(gitreplace)"&&+test"$HASH2$R"="$(gitreplace-l)"&&+test"$HASH2$R"="$(gitreplace)"&&aa=${HASH2%??????????????????????????????????????}&&-test"$HASH2"="$(gitreplace-l"$aa*")"&&+test"$HASH2$R"="$(gitreplace-l"$aa*")"&&test_must_failgitreplace-d$R&&test_must_failgitreplace-d&&test_must_failgitreplace-l-d$HASH2&&
@@ -137,7 +137,7 @@ test_expect_success '"git replace" replacing' 'test_must_failgitreplace$HASH2$R&&gitreplace-f$HASH2$R&&test_must_failgitreplace-f&&-test"$HASH2"="$(gitreplace)"+test"$HASH2$R"="$(gitreplace)"'# This creates a side branch where the bug in H2
From: Christian Couder <hidden> Date: 2016-06-15 22:51:55
On Thu, Aug 25, 2011 at 4:39 PM, Michael J Gruber
[off-list ref] wrote:
The documentation could be misunderstood as if "git replace -l" lists
the replacements of the specified objects. Currently, it lists the
replaced objects.
You could just change the documentation to make it more explicit.
Change the output to the form "<object> <replacement>" so that there is
an easy way to find the replacement, besides the more difficult to find
git show-ref $(git replace -l).
I shamelessly copied the "-l <pattern>" feature and the documentation
from "git tag". If you just change the output of "git replace -l" it
will make the UI inconsistent between both commands.
Maybe you could add a "-L <pattern>" feature to "git replace", "git
tag" and "git branch" that would output "<ref name> <ref content>"?
Thanks,
Christian.
From: Michael J Gruber <hidden> Date: 2016-06-15 22:51:55
Christian Couder venit, vidit, dixit 25.08.2011 18:29:
On Thu, Aug 25, 2011 at 4:39 PM, Michael J Gruber
[off-list ref] wrote:
quoted
The documentation could be misunderstood as if "git replace -l" lists
the replacements of the specified objects. Currently, it lists the
replaced objects.
You could just change the documentation to make it more explicit.
Well, sure. I just didn't find the current form that useful.
quoted
Change the output to the form "<object> <replacement>" so that there is
an easy way to find the replacement, besides the more difficult to find
git show-ref $(git replace -l).
I shamelessly copied the "-l <pattern>" feature and the documentation
from "git tag". If you just change the output of "git replace -l" it
will make the UI inconsistent between both commands.
I don't think many people will expect consistency between branch and tag
on the one hand, and replace refs on the other hand. It requires the
knowledge that a replacement is basically a lightweight tag stored in a
different namespace in refs/, which I would actually consider an
implementation detail.
Maybe you could add a "-L <pattern>" feature to "git replace", "git
tag" and "git branch" that would output "<ref name> <ref content>"?
I'd use "-v" then if this is about consistency, because that *always*
means "verbose", and migrate the misnamed "git tag -v"...
Junio C Hamano venit, vidit, dixit 25.08.2011 21:07:
Michael J Gruber [off-list ref] writes:
quoted
The documentation could be misunderstood as if "git replace -l" lists
the replacements of the specified objects. Currently, it lists the
replaced objects.
Seeing that you had to change existing tests, I do not think this is an
improvement. The existing scripts can read the list of objects and find
replacement themselves (if they want to find that out, that is), no?
If "replace -l" is considered fair game for scripts then the output
should probably not change, though I left the meaning of "$1" for each
line of the output as is on purpose.
But, how would scripts find the replacement? rev-parse does not do it,
rev-list does not do it, and using show-ref requires the user to know
about the actual implementation as refs under refs/replace.
Seems that the doc change is the only option.
Michael
From: Michael J Gruber <hidden> Date: 2016-06-15 22:51:55
Clarify that in list mode, "git replace" outputs the shortened ref
names, not their values.
Also, point to the difficult to find git show-ref $(git replace -l).
Signed-off-by: Michael J Gruber <redacted>
---
Documentation/git-replace.txt | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
@@ -61,6 +61,13 @@ OPTIONS all if no pattern is given). Typing "git replace" without arguments, also lists all replace refs.+++Note that this lists the names of the replace refs, not their values+(not their replacements). You can get the latter like this, e.g.:++------------------------------------------------+$ git show-ref $(git replace -l)+------------------------------------------------ BUGS ----
@@ -76,6 +83,7 @@ replaced by a commit). SEE ALSO --------+linkgit:git-show-ref[1] linkgit:git-tag[1] linkgit:git-branch[1] linkgit:git[1]
From: Christian Couder <hidden> Date: 2016-06-15 22:51:55
On Fri, Aug 26, 2011 at 9:38 AM, Michael J Gruber
[off-list ref] wrote:
Christian Couder venit, vidit, dixit 25.08.2011 18:29:
quoted
On Thu, Aug 25, 2011 at 4:39 PM, Michael J Gruber
[off-list ref] wrote:
quoted
The documentation could be misunderstood as if "git replace -l" lists
the replacements of the specified objects. Currently, it lists the
replaced objects.
You could just change the documentation to make it more explicit.
Well, sure. I just didn't find the current form that useful.
quoted
quoted
Change the output to the form "<object> <replacement>" so that there is
an easy way to find the replacement, besides the more difficult to find
git show-ref $(git replace -l).
I shamelessly copied the "-l <pattern>" feature and the documentation
from "git tag". If you just change the output of "git replace -l" it
will make the UI inconsistent between both commands.
I don't think many people will expect consistency between branch and tag
on the one hand, and replace refs on the other hand. It requires the
knowledge that a replacement is basically a lightweight tag stored in a
different namespace in refs/, which I would actually consider an
implementation detail.
It is an implementation detail, but anyway UI consistency is important
and I would suggest the same behavior even if it was implemented in
another way.
By the way it would be nice to make "git remote" more similar to "git
branch", "git tag" and "git replace" while you are at it.
quoted
Maybe you could add a "-L <pattern>" feature to "git replace", "git
tag" and "git branch" that would output "<ref name> <ref content>"?
I'd use "-v" then if this is about consistency, because that *always*
means "verbose", and migrate the misnamed "git tag -v"...
Yeah, but "git branch -v" is decribed like this:
Show sha1 and commit subject line for each head, along with
relationship to upstream branch (if any). If given twice, print the
name of the upstream branch, as well.
So if you implement it in "git replace" and "git tag", you should at
least show the commit subject line too.
Thanks,
Christian.