-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Idea: use (magit-get-upstream-ref) as ref commit #155
Comments
I don't know. From what I can tell in its docstring,
However, it also looks like the docstring needs to be fixed, so... Maybe the function used to find the "merge base" (all this jargon, it's hard to even know what the correct term is) should be configurable. Patches to that effect are welcome! |
I think I wasn't clear. I mean that instead of calling Note that this suggestion may not work for others, I'm not too familiar with all the possible git workflows. But for me, using |
You were clear, and I understood what you meant. It seems that you didn't quite understand my reply. Did you read carefully the docstring I quoted? As I said, it sounds like they won't do exactly the same thing. So while that change might be better for your workflow, it might not for others. I'm also not convinced about, e.g. But regardless of that, I think what matters is not whether Anyway, like I said: "Maybe the function used to find the "merge base" (all this jargon, it's hard to even know what the correct term is) should be configurable. Patches to that effect are welcome!" |
I think it's a trivial +3 -3, change the 3 occurrences of (or magit-todos-branch-list-merge-base-ref (magit-main-branch)) to (or magit-todos-branch-list-merge-base-ref (magit-get-upstream-ref) (magit-main-branch)) But I think the point is not this, but whether this change is good or not.
I think this is should be true most of the time. Unless someone pushes to master directly.
That is true, my master branch is almost always far behind. If I'm working on a topic branch, why should I keep my master branch up-to-date? It doesn't give me anything. It happens me a lot that my master branch is more than a half year old, simply because I don't use it for anything. On the other hand,
Exactly. And actually, if you create a branch from a remote branch, magit will automatically set the remote branch as the upstream branch. So Is there any case where using |
Well, it's probably a good idea in general to keep it up to date, because that can help avoid mistakes made when rebasing. But that probably depends on one's specific workflow. Git is intended to support a variety of workflows, and I'm not here to tell anyone how to use git in any certain circumstances (even though I might make a general suggestion).
I don't know. IME these issues are complicated and non-intuitive, and, especially, there are a variety of workflows, so it's not clear what a best default is. If I pick one, then some user (like yourself) will come and say that it's not the best default for them. If I pick yours, someone else will likely come along and say the same thing. So, again, if you want this change, let's make it an option, and patches welcome. |
It shouldn't be a problem with magit, because
I am fine with my little code snippet I presented in the first comment. I just wanted to make other's life easier, because I think that my suggestion is a better default. For the usual git workflow, it works in a more sensible way. But I don't really want to argue about this further, neither design a full-fledged feature with options and whatnot, and then write extra code which seems unnecessary. So I'm closing this issue. |
IME that depends on how the repository and branch in question are configured. It's not guaranteed to be the same in all cases. And so far I've yet to encounter a situation where the current code fails. So it's not clear to me that making this change would be more likely to be generally correct.
A patch to call a function selected in an option would be trivial, something like 5 lines of code including docstring--certainly far fewer characters than any of these messages we've exchanged. If you really think that your suggestion is a better default, it would help to convince me if you'd respond to the points made in the function's docstring, which I mentioned twice. This is a decision that can't be made without concrete examples of the problem and how your suggestion solves them. Otherwise, as I said, we'll likely just bounce between "this works better for me" and "but that works better for me." Anyway, the idea is worth considering, so there's no need to close the issue yet. If you don't want to write such a patch, maybe another user will want to. |
Compared to what? (sorry, I genuinely don't know what you're referring to by "same")
It failed for me (more than 3 years ago, I don't remember the details), because as I said, my
Not how I usually think about this. If it's an option, then the question arises, should it be a new option? Or should it be that if Regarding the docstring question. I'm not sure exactly what the problem is here (this functions just returns the
If, for any reason, the upstream is not set ( I don't want to convince you. I just suggested an idea. If you like it, you can implement it. If not, then don't. To me, it doesn't matter too much, because I already have my solution for this problem. I just created this issue because to me it seems a better default behavior, from which other people can benefit. But maybe I'm wrong about this, so apparently some feedback is definitely needed from others who are more experienced with the different kind of git workflows. |
The branch configuration, i.e. what's listed when pressing Really, what's needed is a list of scenarios and the various values produced by each possibility so we can see what the results of the status quo and this proposed change would be. |
I'm still not quite sure what the question is here. There is a setting pair in git, Regarding scenarios. Even if there are thousands ways of using git, there has to be some default setting in magit, and also in magit-todos. I believe that it makes sense to follow how magit works by default, or at least, what workflow it supports in the most convenient way. It is clearly described here: https://magit.vc/manual/magit/The-Two-Remotes.html. The only thing that is somewhat confusing in this description is that it calls the upstream remote as But frankly. Suppose that I use magit to create a new branch from some branch. Magit will ask the base branch, and the new branch will be based on this. Magit (or git) sets the upstream setting (remote+merge) to this base branch, if it is remote (or something like this - not sure why git does this only in the case if the branch is remote). So far, nothing has anything to do with the local |
This is just an idea/suggestion. I see that magit-todos uses
(magit-main-branch)
to figure out (usingmerge-base
) the revision to compare the HEAD against.How about using
(magit-get-upstream-ref)
instead? I'm suggesting this, because people might not update theirmain
branch for a long time, so it gets out of sync, andmerge-base
may find some very ancient revision, so we get a lot of entries in the TODO list.On the other hand,
(magit-get-upstream-ref)
is usually more up-to-date, and it also more likely contains a more relevant revision to find the merge base.What do you think?
I've been using this idea for a while, and it seems to work for me. If anyone interested, I use this snippet to achieve this:
The text was updated successfully, but these errors were encountered: