poll: when you see this message in `git status`:
”Your branch is up to date with 'origin/main’.”
do you know that your branch may not actually be up to date with the `main` branch on the remote?
poll: when you see this message in `git status`:
”Your branch is up to date with 'origin/main’.”
do you know that your branch may not actually be up to date with the `main` branch on the remote?
@rst @unlambda @mxey @b0rk yes, agreed, it should be simple conceptually and implementation-wise to meet the need; I was just making the point that an implementation _is_ needed, since the required information is not already present in the existing data structures.
Hmm, I _think_ a proc-receive hook¹ could potentially offer a prototype implementation with no core changes but to be honest that documentation is a little obtuse. I'll have to read the code some more.
@nasamuffin the edge case i was worried about is that it looks like it doesn't update the mtime if you push (or fetch) and there were no updates?
(which makes sense because it wasn't modified, but the thing I _want_ is to know “we know that this is up to date as of X time” not “this is the last time there were new changes”)
@b0rk It shouldn't bee too difficult to implement; the reflog already contains that information:
~/src/git$ git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
~/src/git$ git reflog --date=relative origin/main
f5aaf72f1b (HEAD -> main, origin/master, origin/main, origin/HEAD) refs/remotes/origin/main@{1 year, 10 months ago}: fetch: fast-forward
0f828332d5 (master) refs/remotes/origin/main@{1 year, 10 months ago}: fetch: fast-forward
@b0rk the general case slams into the possibility of multiple remotes. (I mean, I'm a cabbage and my personal repository has multiple remotes, that's how I back it up.)
"Nothing's different that we know about. Ask a remote?" or similar might be a better message anyway.
@unlambda @b0rk Dim recollection says you don't get that specific remote tracking branch message when you didn't clone the repo/don't have a default remote.
In that specific extremely common case, sure, you could ask the reflog. But I wouldn't want to try to talk the git maintainers into considering that a general solution.
@b0rk This confused me for years. Even though it’s correct in git’s world, it seems hostile.
I don’t love the time idea because it perpetuates the misleading idea that it’s checking. It’s really just talking about to sets of files on one machine, so I feel as if ‘up to date with your local copy of’ or ‘’the last fetch of’ would help me more.
@rjbs @mjd @b0rk Here's an incomplete but working patch. https://gist.github.com/tsibley/81d144149812b009e833b9b1a667c2b9
I've thought about this a bit before and have been meaning to look into it for a while... so I got nerdsniped this afternoon. Might try to see this thru to patch submission.
@rjbs @mjd @b0rk Oh bah, I see I totally misunderstood and missed this edge case: https://social.jvns.ca/@b0rk/112061735287996245
orz
Apologies.
Attached: 1 image @[email protected] the edge case i was worried about is that it looks like it doesn't update the mtime if you push (or fetch) and there were no updates? (which makes sense because it wasn't modified, but the thing I _want_ is to know “we know that this is up to date as of X time” not “this is the last time there were new changes”)
@rjbs @mjd @b0rk Extended the patch to solve that by recording all fetches in the reflog. https://gist.github.com/tsibley/0eb1f9d227b143fb7fe97fc2661eac9a
Not sure that'd fly with the git maintainers or not... but I might try to engage and see!
@b0rk I'm not sure if it would be possible without adding something extra.
Git can always check the committer date of the last commit on remote-tracking branch, but it this would not change when you refresh and remote does not have any changes.
With remote-tracking branch stored as loose ref (a file), you can check the modification time... but not if it is turned into packed ref, or if in the future Git would start using reftables backend for storing branches and remote-tracking branches.
@b0rk or to be more exact: modification time of loose ref would not change (as other already wrote) if the ref didn't change, and if it did not change for long time, it could be repacked into packed-ref format (and loose even this bit of information).
The reflog could record every fetch, successful or not, but I am not sure if it would not have some complications in other parts of git.