~sircmpwn/sr.ht-discuss

3 3

Does the log of a file take into account the moving of the file?

Details
Message ID
<bf9bb233-752b-d2c0-1ced-403ed04c8904@quaternum.net>
DKIM signature
missing
Download raw message
Hi,

Sorry if my question has already been asked (I did not find a similar 
question). When (on the web interface) I display the log of a file that 
has been moved (with git mv), I don't find all the associated commits, 
but only those since the move of this file, is this normal?

Example:

- a commit for a specific file: 
https://git.sr.ht/~antoinentl/www.quaternum.net/commit/4fc2a61942f82d32f80a05a2dc4cd7dbbc4c5ffa

- the log for the same file (where I don't find the previous commit): 
https://git.sr.ht/~antoinentl/www.quaternum.net/log/master/item/content/flux/2018/2018-10-16-les-videos-de-prepostprint-a-l-ensad.markdown

If my question is not clear I can detail it or rewrite it.

Thanks!
-- 
Antoine
antoine@quaternum.net
www.quaternum.net <http://www.quaternum.net>
Details
Message ID
<72a23c0c-b284-9d22-650b-b9d82c700232@bitfehler.net>
In-Reply-To
<bf9bb233-752b-d2c0-1ced-403ed04c8904@quaternum.net> (view parent)
DKIM signature
pass
Download raw message
On 3/26/22 17:58, Antoine Fauchié wrote:
> Sorry if my question has already been asked (I did not find a similar 
> question). When (on the web interface) I display the log of a file that 
> has been moved (with git mv), I don't find all the associated commits, 
> but only those since the move of this file, is this normal?

"Normal" to the extend that this is the default behavior of `git log`. 
The full answer is, as always, "it's complicated" and usually revolves 
around the notion that "git tracks content, not files".

See this SO post [1], the question as well as several of the highest 
rated answers have quite a lot of background and links for further reading.

[1] https://stackoverflow.com/questions/5743739

Conrad
Details
Message ID
<69f9870c-c68e-732d-9b13-236b98ffcb49@quaternum.net>
In-Reply-To
<72a23c0c-b284-9d22-650b-b9d82c700232@bitfehler.net> (view parent)
DKIM signature
missing
Download raw message
Thank you for pointing out that "normal" is not appropriate here. I just 
discover why `git log` is not what I thought it was: perhaps Git 
platform/service like GitLab, Gitea or GitHub are confusing the issue 
with a _history option_ that is very different than a `git log`. Also 
Sourcehut respects the fondamental principles of Git, it makes sense.

And it's very interesting (for me) to learn how much Git is content 
oriented and not files oriented. Thank you for helping me to understand 
better Git (I will try some solutions from the SO post).
-- 
Antoine
antoine@quaternum.net
www.quaternum.net
Details
Message ID
<20220520012909.ukq3klteuxovfo77@microconnector.local>
In-Reply-To
<69f9870c-c68e-732d-9b13-236b98ffcb49@quaternum.net> (view parent)
DKIM signature
pass
Download raw message
On Sat, Mar 26, 2022 at 09:53:50PM -0400, Antoine Fauchié wrote:
> And it's very interesting (for me) to learn how much Git is content oriented
> and not files oriented. Thank you for helping me to understand better Git (I
> will try some solutions from the SO post).

You may want to try the --follow option.  This will follow renames.

See:

    man git-log

In the OPTIONS section, under --follow

It states:

    Continue listing the history of a file beyond renames (works only
    for a single file).

Reading the man pages from `man git` to man git-log` and other `git-`
patterns gives a full picture, probably more than you ever wanted to
know.
Reply to thread Export thread (mbox)