Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

proposal: save local config to .git/config #384

Closed
maxice8 opened this issue Dec 22, 2020 · 9 comments · Fixed by #813
Closed

proposal: save local config to .git/config #384

maxice8 opened this issue Dec 22, 2020 · 9 comments · Fixed by #813
Labels
proposal: accepted Proposal has been accepted and a PR can be created to resolve the issue proposal stale

Comments

@maxice8
Copy link
Collaborator

maxice8 commented Dec 22, 2020

Description
I set host of a repo to gitlab.alpinelinux.org and glab wrote .glab-cli/config/config.yaml, to hide it wrote to .gitignore.

Expected Behavior vs Actual Behavior
It to write somewhere where it doesn't modify my repository like .git/config in a [glab] section

Steps to Reproduce

  1. glab config set editor nvim

Your Environment

  • Version used (Run glab --version): glab version 1.12.1-82-g0c3ff7e (2020-12-21)
  • Operating System and version: Fedora SilverBlue 33
@maxice8 maxice8 added the bug Something isn't working label Dec 22, 2020
@profclems
Copy link
Owner

profclems commented Dec 22, 2020

To avoid this modifying the .gitignore, use the --global flag.

I agree with your proposal though. This is something I have thought about and I knew it will be brought.
We thought of making glab write to the global config by default but halted for backward compatibility reasons.

@profclems
Copy link
Owner

I'm changing the issue title to "save local config to .git/config" and mark it as a proposal since it is not really a bug.
We already know it changes the .gitignore when a local config is created

@profclems profclems changed the title glab-cli touches .gitignore proposal: save local config to .git/config Dec 22, 2020
@profclems profclems added proposal and removed bug Something isn't working labels Dec 22, 2020
@maxice8
Copy link
Collaborator Author

maxice8 commented Dec 23, 2020

Another thing, will it be possible to save configuration like defaults for --when-pipeline-succeeds ?

@profclems
Copy link
Owner

I haven't thought about this but we can add it up. It is not currently a respected setting.

@maxice8
Copy link
Collaborator Author

maxice8 commented Dec 23, 2020

At the moment I have a shellscript that does what I need:

#!/bin/sh
opts=""
mrs=""
for arg; do
    case "$arg" in
        ''|*[!0-9]*) opts="$opts $arg" ;;
        *) mrs="$mrs $arg" ;;
    esac
done

[ -n "$mrs" ] || exit 1

if [ -n "$AMR_DRY_RUN" ]; then
    printf -- "Merge Requests: !%s\n" $(printf -- "%s" "$mrs")
    printf -- "Opts: %s\n" $(printf -- "%s" "$opts")
    exit 0
fi

for mr in $mrs; do
    glab mr rebase "$mr" && glab mr merge "$mr" --when-pipeline-succeeds=false $opts
done

@profclems
Copy link
Owner

Nice. This has brought up a nice-to-have feature for glab: merging multiple merge requests with comma-separated ids as arg

$ glab mr merge 1,2,3,4
#=> merges MRs with ids 1, 2, 3, and 4 💬

@maxice8
Copy link
Collaborator Author

maxice8 commented Dec 23, 2020

Wouldn't it be better to just accept an arbitrary number of arguments, each one being an id ?

There are no positional arguments beside the merge request ids, all options are flags.

@profclems profclems added the proposal: accepted Proposal has been accepted and a PR can be created to resolve the issue label Dec 28, 2020
@profclems
Copy link
Owner

This will be much easier to work on if we move the local config .glab-cli to .git/glab-cli.

With the migration, at first run, we check if the there's a local config file and move it to .git/glab-cli

@clemsbot
Copy link
Collaborator

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
proposal: accepted Proposal has been accepted and a PR can be created to resolve the issue proposal stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants