-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Refactor git storage and command #22775
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
Conversation
args []string | ||
parentContext context.Context | ||
desc string | ||
extraDesc string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To keep the default description, so we can remove most descriptions when invoking git command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then SetDescription
will be removed, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That still will be kept but in most places, we don't need that function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SetDescription still will be kept but in most places, we don't need that function.
Then I still can not get the point why SetDescription
and SetExtraDescription
should both exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After grepping the calls to SetDescription
and SetExtraDescription
. If I understand correctly, the SetDescription
is mainly for making the description of git command with long arguments to be concise and add repoPath to the description.
But SetDescription
and SetExtraDescription
really seem similar and may be misused later ....
(just a discussion, no more thoughts from my side)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just thought about an interesting idea:
cmd.SetDescription("totally new description: %s, %d", filename, line)
cmd.SetDescription("${cmd}, and extra description: %s, %d", filename, line)
The ${cmd}
could be replaced by the command and arguments.
Then only one function is enough. And one command always have one description (no extra
). And no need to call Sprintf
separately when setting the description.
ps: I know the trick ${cmd}
is arguable, so not sure whether it is good enough, just FYI and for fun.
replaced by #25071 |
No description provided.