Giter Site home page Giter Site logo

Comments (4)

sorenlouv avatar sorenlouv commented on July 27, 2024

@legrego That's a great idea!

Specify editor
How do you think the user should specify their editor of choice? I think it could be done in the backportrc.json config where the user also specifies their credentials, or via the standard environment variables like $EDITOR and/or $VISUAL.

Prompt
The prompt is definitely an option but I'm leaning towards just opening the editor, if the user has specified one (that seems like confirmation enough).

Conflicting files
After your editor has opened, how do you determine the conflicting files? I always cd to the dir, and run git status to get an overview, and then fix them. Perhaps the output of git status should be displayed directly to the user, when a conflict occurs?

Finalising the conflict resolution
Currently the user is required to finalise the conflict resolution by staging and committing the changes. It would be great if the user didn't have to cd to the directory at all anymore - but I'm not sure how to accomplish this.
One option is that backport stages and commits automatically when the user clicks "enter". This could have unforeseen consequences (if they forgot to fix a conflict, which will now be committed).

from backport.

sorenlouv avatar sorenlouv commented on July 27, 2024

There is currently a check to determine if the conflicting files have been staged and committed. It is not possible to continue if this check fails but I can add a confirmation prompt to let backport do this automatically:

Backporting #28692 to 6.6
✔ Pulling latest changes
✖ Cherry-picking failed. Opening your editor `code` in: /Users/larry/.backport/repositories/elastic/kibana
? Press <enter> when you have resolved the merge conflicts Yes

The following changes will be staged and committed: 
--- a/animals.txt
+++ b/animals.txt
@@@ -3,3 -3,13 +3,16 @@@ canin
  dog
  cat
  mouse
+ horse
+ spider
+ elephant
+ dinosaur

? Continue? Yes
✔ Pushing branch legrego:backport/6.6/pr-28692
✔ Creating pull request
View pull request: https://github.com/elastic/kibana/pull/28701

_Note to self:

  • use git --no-pager diff to get the diff, and git add -A && git commit --no-edit to automatically staged and commit with the original commit msg_
  • list conflicting files: git --no-pager diff --name-only --diff-filter=U
  • finalize cherrypick sequence: git -c core.editor=true cherry-pick --continue

from backport.

legrego avatar legrego commented on July 27, 2024

Thank you for the thoughtful followup!

How do you think the user should specify their editor of choice? I think it could be done in the backportrc.json config where the user also specifies their credentials, or via the standard environment variables like $EDITOR and/or $VISUAL.

I'd prefer to set it in backportrc.json, that way it's more portable. I try to avoid environment variables, but that's probably just me :)

After your editor has opened, how do you determine the conflicting files? I always cd to the dir, and run git status to get an overview, and then fix them.

VSCode has a decent git integration which automatically shows me conflicts and staged files. For me, just opening the editor at the repository path would be sufficient.

For folks that want more, maybe this configuration setting is more of a command template, where we could configure something like: code ${repoPath} && git status?

Perhaps the output of git status should be displayed directly to the user, when a conflict occurs?

I'm not opposed to this, but if it's not too much work, maybe this is a configurable setting too? I like how concise the backport output is today, and throwing the output of git status in the middle of that would muddy the output IMO.

Currently the user is required to finalise the conflict resolution by staging and committing the changes. It would be great if the user didn't have to cd to the directory at all anymore - but I'm not sure how to accomplish this.
One option is that backport stages and commits automatically when the user clicks "enter". This could have unforeseen consequences (if they forgot to fix a conflict, which will now be committed).

Would we be able to leverage git diff --check to detect conflict markers before issuing the commit?

from backport.

legrego avatar legrego commented on July 27, 2024

I like your second proposal to show the diff after confirming that merge conflicts are resolved!

from backport.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.