Re: [Possible GIT Bug]

2018-09-10 Thread Junio C Hamano
"Eckhard Maaß"  writes:

> On Mon, Sep 10, 2018 at 09:03:10AM -0700, Junio C Hamano wrote:
>> It is neither but if I have to pick one between the two, it is much
>> closer to the former than the latter.  The primary source of this is
>> that we have only *one* pathspec given to the diff machinery, but in
>> order to implement your ideal "find harder", you'd need *two*.  That
>> is, one set of paths for which you are interested in their origin,
>> and the other set that you allow the machinery to consider as possible
>> origins.  Since we can only give one pathspec machinery, that one
>> pathspec is used to specify both of these sets.
>
> How does tihs compare to `--follow`? With that knob active the machinery
> indeed uses the whole repository for finding renames and/or copies. Is
> this the only exception then?

'--follow' is a checkbox hack that is not even properly integrated
with the diff machinery (it only exists on the "log" side of the
tool), so I do not think it is productive to find a comparison.


Re: [Possible GIT Bug]

2018-09-10 Thread Eckhard Maaß
On Mon, Sep 10, 2018 at 09:03:10AM -0700, Junio C Hamano wrote:
> It is neither but if I have to pick one between the two, it is much
> closer to the former than the latter.  The primary source of this is
> that we have only *one* pathspec given to the diff machinery, but in
> order to implement your ideal "find harder", you'd need *two*.  That
> is, one set of paths for which you are interested in their origin,
> and the other set that you allow the machinery to consider as possible
> origins.  Since we can only give one pathspec machinery, that one
> pathspec is used to specify both of these sets.

How does tihs compare to `--follow`? With that knob active the machinery
indeed uses the whole repository for finding renames and/or copies. Is
this the only exception then?

Take care,
Eckhard


Re: [Possible GIT Bug]

2018-09-10 Thread Junio C Hamano
Jeff King  writes:

> Your explanation is correct. To be fair, though, it seems like
> --find-copies-harder is made a lot less useful by the not considering
> the larger set of sources, since that's kind of its point. I'm not sure
> if this behavior actually is intentional, or simply what happens to
> occur based on the combination of features.

It is neither but if I have to pick one between the two, it is much
closer to the former than the latter.  The primary source of this is
that we have only *one* pathspec given to the diff machinery, but in
order to implement your ideal "find harder", you'd need *two*.  That
is, one set of paths for which you are interested in their origin,
and the other set that you allow the machinery to consider as possible
origins.  Since we can only give one pathspec machinery, that one
pathspec is used to specify both of these sets.


Re: [Possible GIT Bug]

2018-09-10 Thread Jeff King
On Sun, Sep 09, 2018 at 12:04:58PM -0700, Bryan Turner wrote:

> Here, though, you've _explicitly limited_ Git to only the copied file.
> It's not allowed to consider any others, which means it can't "see"
> the source path anymore. As a result, the copy is detected as a
> straight add. Note that --find-copies-harder means the diff machinery
> is allowed to consider files that weren't modified in the commit as
> possible sources for copies, but that's still subject to your explicit
> filtering. In other words, if PATH_TO_SOURCE_FILE wasn't modified,
> running this would _not_ see a copy:
> 
> git show -C 055f6c89fa4506037d1621761f13430f469b8029  --
> PATH_TO_MY_COPIED_FILE PATH_TO_SOURCE_FILE
> 
> But running this would:
> 
> git show -C -C 055f6c89fa4506037d1621761f13430f469b8029  --
> PATH_TO_MY_COPIED_FILE PATH_TO_SOURCE_FILE
> 
> No bugs here. Everything is working as intended, if not, perhaps, as
> you expected.

Your explanation is correct. To be fair, though, it seems like
--find-copies-harder is made a lot less useful by the not considering
the larger set of sources, since that's kind of its point. I'm not sure
if this behavior actually is intentional, or simply what happens to
occur based on the combination of features.

You can do:

  git log -C C --full-diff $commit -- $path

to limit a traversal to commits touching $path, but still see the full
diff (including possible copy sources). But AFAIK there's no option to
limit the diff, but include extra copy sources.

I'd be tempted to say we should do that automatically when
--find-copies-harder is in effect, but it's possible that some people
actually do want the current behavior. For a single path it's silly, but
if you did something like this:

  git show -C -C $commit -- foo/

that would find differences in the foo/ directory, and find copies only
from sources in foo/. That limits the result, but also limits the
effort, which can be important given the cost of copy detection.

-Peff


Re: [Possible GIT Bug]

2018-09-09 Thread Bryan Turner
On Sun, Sep 9, 2018 at 6:31 AM Dylan Young  wrote:
>
> Works:
>
> git show -C --find-copies-harder  055f6c89fa4506037d1621761f13430f469b8029
>
> git show -C --find-copies-harder
> 055f6c89fa4506037d1621761f13430f469b8029 --name-status

Here, because you didn't provide _any_ paths, Git is allowed to
consider all of the paths modified in the commit and, because you
specified --find-copies-harder, it's allowed to consider paths that
_weren't_ modified too. That means it can "see" both the source and
destination for the copy, and it detects the copy as you're expecting.

>
> Doesn’t Work:
>
> git show -C --find-copies-harder
> 055f6c89fa4506037d1621761f13430f469b8029  --  PATH_TO_MY_COPIED_FILE

Here, though, you've _explicitly limited_ Git to only the copied file.
It's not allowed to consider any others, which means it can't "see"
the source path anymore. As a result, the copy is detected as a
straight add. Note that --find-copies-harder means the diff machinery
is allowed to consider files that weren't modified in the commit as
possible sources for copies, but that's still subject to your explicit
filtering. In other words, if PATH_TO_SOURCE_FILE wasn't modified,
running this would _not_ see a copy:

git show -C 055f6c89fa4506037d1621761f13430f469b8029  --
PATH_TO_MY_COPIED_FILE PATH_TO_SOURCE_FILE

But running this would:

git show -C -C 055f6c89fa4506037d1621761f13430f469b8029  --
PATH_TO_MY_COPIED_FILE PATH_TO_SOURCE_FILE

No bugs here. Everything is working as intended, if not, perhaps, as
you expected.

Hope this helps,
Bryan

>
> i.e.
>
> --- /dev/null
>
> +++ b/ PATH_TO_MY_COPIED_FILE
>
> Hope that’s self-explanatory!!!
>
> Best,
> Casey Meijer


Fwd: [Possible GIT Bug]

2018-09-09 Thread Dylan Young
Works:



git show -C --find-copies-harder  055f6c89fa4506037d1621761f13430f469b8029

git show -C --find-copies-harder
055f6c89fa4506037d1621761f13430f469b8029 --name-status





Doesn’t Work:



git show -C --find-copies-harder
055f6c89fa4506037d1621761f13430f469b8029  --  PATH_TO_MY_COPIED_FILE



i.e.

--- /dev/null

+++ b/ PATH_TO_MY_COPIED_FILE





Hope that’s self-explanatory!!!



Best,





Casey Meijer


Re: Possible git bug

2013-08-14 Thread Jeff King
On Wed, Aug 14, 2013 at 07:42:11AM +0200, Daniel Knittl-Frank wrote:

  So would that be a bug? Or maybe a feature? I would like it that
  when you do a rebase and select no commits, it will rebase ontop of
  the commit you chose, and remove all the commits not shown in the
  interactive listing (so all).
 
 You can just use `git reset --hard commit to rollback to`  to
 discard all commits after the given commit (Unless they're part of
 another branch, of course). `git reset --soft` if you want to keep the
 state of your current working directory.

You can also use a noop line in the rebase instruction list rather
than a completely blank list to mean yes, really, do not apply any
commits.

-Peff
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Possible git bug

2013-08-13 Thread Hugh Davenport

Hey,

Not sure if this is a bug or not. I commonly am finding myself wanting 
to
remove some recent commits, either all or just a select few. So I use 
rebase
in interactive mode for this. The problem I find is that when I do a 
rebase
and leave no commits to pick (where I would think that this would do the 
same

as a reset --hard) just tells me that there is nothing to be done.

So would that be a bug? Or maybe a feature? I would like it that when 
you do
a rebase and select no commits, it will rebase ontop of the commit you 
chose,
and remove all the commits not shown in the interactive listing (so 
all).


Any ideas are welcome.

Cheers,

Hugh
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Possible git bug

2013-08-13 Thread Daniel Knittl-Frank
On Wed, Aug 14, 2013 at 6:50 AM, Hugh Davenport h...@davenport.net.nz wrote:
 Hey,

 Not sure if this is a bug or not. I commonly am finding myself wanting to
 remove some recent commits, either all or just a select few. So I use rebase
 in interactive mode for this. The problem I find is that when I do a rebase
 and leave no commits to pick (where I would think that this would do the
 same
 as a reset --hard) just tells me that there is nothing to be done.

This is left as a way to abort a rebase if you change your mind just
before actually executing it. This also works parallel to committing
with an empty commit message.

 So would that be a bug? Or maybe a feature? I would like it that when you do
 a rebase and select no commits, it will rebase ontop of the commit you
 chose,
 and remove all the commits not shown in the interactive listing (so all).

You can just use `git reset --hard commit to rollback to`  to
discard all commits after the given commit (Unless they're part of
another branch, of course). `git reset --soft` if you want to keep the
state of your current working directory.

Cheers,
Daniel

-- 
typed with http://neo-layout.org
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html