Skip to content
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

refactor(git): Use 'git -C' to specify the work directory instead of 'Push-Location'/'Pop-Location' #4697

Merged
merged 8 commits into from
Feb 1, 2022

Conversation

HUMORCE
Copy link
Member

@HUMORCE HUMORCE commented Jan 28, 2022

Description

no longer using Push-Location to change work directory before executing git operations

Motivation and Context

Fixes #4358
Fixes #4675

send ^C(SIGINT) will change current directory to bucket path, when scoop is updating buckets.

solve:
using command options -C to specify the work directory for git, then no longer need to change the <work directory> with Push-Location and Pop-Location.

How Has This Been Tested?

before:

PS C:\Users\WDAGUtilityAccount> scoop update
Updating Scoop...
Updating 'main' bucket...
^C
PS C:\Users\WDAGUtilityAccount\scoop\buckets\main>

after:

PS C:\Users\WDAGUtilityAccount> scoop update
Updating Scoop...
Updating 'main' bucket...
^C
PS C:\Users\WDAGUtilityAccount>

tested on PS 5.1 and PS Core 7.2 in sandbox, the changes will not affect other areas.

Checklist:

  • I have read the Contributing Guide.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.

@HUMORCE
Copy link
Member Author

HUMORCE commented Jan 28, 2022

and what type of this PR should be?

@rashil2000
Copy link
Member

rashil2000 commented Jan 28, 2022

I think 'refactor`

Fixes #4358 #4675

@HUMORCE
Copy link
Member Author

HUMORCE commented Jan 28, 2022

thanks about that

@HUMORCE HUMORCE changed the title Use git -C instead of use Push-Location and Pop-Location when executing git operations refactor(git): Use 'git -C' to specify the work directory instead of 'Push-Location'/'Pop-Location' Jan 29, 2022
@HUMORCE HUMORCE marked this pull request as ready for review January 29, 2022 10:49
@rashil2000
Copy link
Member

Looks good.

The functions git_fetch, git_pull and git_checkout can be removed from lib/git.ps1 now, since they're not being used anywhere.

- `git_fetch`
- `git_pull`
- `get_checkout`
@rashil2000 rashil2000 merged commit 5b0bdaf into ScoopInstaller:develop Feb 1, 2022
@HUMORCE HUMORCE deleted the stop-jump branch February 1, 2022 13:45
se35710 pushed a commit to se35710/scoop that referenced this pull request Mar 8, 2022
…'Push-Location'/'Pop-Location' (ScoopInstaller#4697)

* add `git_cmd`

-without any preset command/args

* remove unnecessary import

- `git.ps1`

* stop `Push-Location` and `Pop-Location` before/after git operations

* stop `Push-Location` and `Pop-Location` before/after git operations

* consistency of naming variable

* CHANGELOG

* punctuation mark

* remove functions that are no longer used

- `git_fetch`
- `git_pull`
- `get_checkout`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants