Skip to content

Global and local .gitconfig get and set functions #230

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

Merged
merged 10 commits into from
Dec 14, 2020
Merged

Conversation

jettseale
Copy link
Collaborator

Includes two main functions:

  1. getConfig returns the value of the given corresponding key path from a specified local .gitconfig file. If this fails, it searches for the value in the global .gitconfig file. If this fails, it returns undefined.
  2. setConfig changes the value of the given corresponding key path. Depending on the which parameter, it either writes to the local .gitconfig file, the global .gitconfig file, or both. If the given value is undefined, it deletes the entry.

Also includes three helper functions for the above two functions:

  1. findAllByKey recursively finds all values within a given nested object that correspond to a given key.
  2. getGlobalGitAuthorInfo finds the global .gitconfig file path, then asynchronously constructs a parseGitConfig.Config object containing all of the fields found within the global .gitconfig file.
  3. replaceObjKey replaces a given parseGitConfig.Config object key value with another given value.

Copy link
Member

@nelsonni nelsonni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are almost ready for merging. Once the requested changes have been made and pushed up, I will approve and integrate them. However, please be aware that the CI jobs failed due to some tests and snapshots needing to be updated: https://github.com/EPICLab/synectic/pull/230/checks?check_run_id=1495905949. I'll still approve the changes regardless, but if you can update the snapshots that would be helpful.

@nelsonni
Copy link
Member

nelsonni commented Dec 5, 2020

These changes are almost ready for merging. Once the requested changes have been made and pushed up, I will approve and integrate them. However, please be aware that the CI jobs failed due to some tests and snapshots needing to be updated: https://github.com/EPICLab/synectic/pull/230/checks?check_run_id=1495905949. I'll still approve the changes regardless, but if you can update the snapshots that would be helpful.

Actually, never mind about the CI test results. Apparently timestamps in Ubuntu don't default to include timezone modifiers and instead use the -00:00 timezone:

    - Snapshot  - 2
    + Received  + 2

      Object {
        "40d14391c": Object {
          "captured": false,
    -     "created": "2019-11-19T19:22:47.572-08:00",
    +     "created": "2019-11-20T03:22:47.572-00:00",
          "id": "40d14391c",
          "left": 178,
          "metafile": "29334943",
    -     "modified": "2019-11-22T12:54:11.374-08:00",
    +     "modified": "2019-11-22T20:54:11.374-00:00",
          "name": "card1",
          "top": 540,
          "type": "Editor",
        },
      }

Tests will have to be fixed by me in another PR.

@nelsonni nelsonni merged commit 575d9ac into development Dec 14, 2020
@nelsonni nelsonni deleted the git-config branch December 14, 2020 03:25
@nelsonni nelsonni added the feature Feature requests or improvements label Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature requests or improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants