GithubHelp home page GithubHelp logo

git-commands's Issues

Changes no longer uses git-changes.default-branch when -b|--branch isn't used

$ git log --oneline develop..HEAD
f046c5f Update properties
$ git log --oneline master..HEAD
f046c5f Update properties
7b8db15 Update changelog
$ git config --local git-changes.default-branch
develop
$ git changes -b develop
f046c5f Update properties
$ git changes
f046c5f Update properties
7b8db15 Update changelog

The last two commands should be identical.

State is broken for new repositories

$ git init testing
$ cd testing
$ git state
Traceback (most recent call last):
  File "/Users/User/Development/python/git-commands/bin/git-state", line 256, in <module>
    main()
  File "/Users/User/Development/python/git-commands/bin/git-state", line 253, in main
    state.state(**vars(parser.parse_args()))
  File "/Users/User/Development/python/git-commands/bin/commands/state.py", line 144, in state
    for section_info in sections:
UnboundLocalError: local variable 'sections' referenced before assignment

Add --quiet options

Specifically, for non-informative commands.

  • abandon
    • Make sure it can't be used with --dry-run. That wouldn't make sense.
  • restash
  • snapshot
  • tuck

Extensions don't support quoted strings

If an extension contains a quoted string, the underlying command isn't executed correctly.

$ git config git-state.extensions.print-message "printmessage \"this is the message\""
$ git state -STBLR
# print-message

    message: this
$

Use shlex so that quotes strings are maintained:

import shlex
command = shlex.split('printmessage "this is the message"')

Restash fails to remove untracked files

$ touch file.txt 
$ git status --short
?? file.txt
$ git stash save -u
Saved working directory and index state WIP on gitignore: 3e72f3b Remove now ignored file
HEAD is now at 3e72f3b Remove now ignored file
$ git stash apply
Already up-to-date!
On branch gitignore
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    file.txt

nothing added to commit but untracked files present (use "git add" to track)
$ git restash
fatal: unrecognized input
$ git status --short
?? file.txt

Add tucking to snapshot

It would be nice to be able to create a snapshot of only a few files.

$ git snapshot -- *.txt README.md

Use action store_const in favor of FlagAsValue

FlagAsValue is unnecessary since out of the box argparse options have the same result.

For instance:

# -r|--remote
branch_group.add_argument(
    '-r',
    '--remote',
    help='show the commits between the local and remote head',
    action=flag_as_value(upstream.upstream(True)),
    nargs=0,
    dest='branch'
)

is equivalent to:

# -r|--remote
branch_group.add_argument(
    '-r',
    '--remote',
    help='show the commits between the local and remote head',
    action='store_const',
    dest='branch',
    const=upstream.upstream(True)
)

git-state leaves an empty color section in config files

When git-state prints the status section in color it needs to write to the color.ui configuration. If the user didn't have any other color settings, the section is left empty in the config. Each execution adds a new empty section.

After five executions the local config file might look like this:

[git-state "reflog"]
        show = false
[color]
[color]
[color]
[color]
[color]

Typo in tuck documentation

The man pages for git-tuck and main README.md contain the following:

Used to stash specific files rather than the all-or-thing style of git stash.

It should be all-or-nothing.

Settings list does not handle multiline keys

[alias]
    # Merge GitHub pull request on top of the `master` branch
    mpr = "!f() { \
        if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \
            git fetch origin refs/pull/$1/head:pr/$1 && \
            git rebase master pr/$1 && \
            git checkout master && \
            git merge pr/$1 && \
            git branch -D pr/$1 && \
            git commit --amend -m \"$(git log -1 --pretty=%B)\n\nCloses #$1.\"; \
        fi \
    }; f"

The problem is with the newlines (\n) and not the line continuations (\).

Setting's HTML man page has formatting issues

FILE OPTIONS
    Some subcommands can be limited to a specific file. The valid options are:

    --       Use local config file.
    local

It should be:

FILE OPTIONS
    Some subcommands can be limited to a specific file. The valid options are:

    --local
            Use local config file.

Use colorama for coloring

Using colorama will allow coloring on Windows machines, as well.

from colorama import Fore
# ...
title = '{no_color}({green}master{no_color})'.format(no_color=Fore.RESET, green=Fore.GREEN)

Tuck's default stash message uses an intermediate commit

The default stash message using tuck references a commit that is temporarily created during the tuck operation.

$ git log --oneline
5968ba1 Edit readme
3149cb4 Add files
97d7bcc Initial commit
$ git status --short
 M README.md
M  file1.txt
 M file2.txt
$ git tuck -- file*.txt
Tucked files: file1.txt file2.txt
$ git stash list --oneline
698d871 refs/stash@{0}: WIP on master: aebd142 TUCK: unstaged

Ideally the message would be based on the HEAD commit before the command is executed:

698d871 refs/stash@{0}: WIP on master: 5968ba1 Edit readme

Both changes --stat and --diff show unrelated changes when the branch isn't the merge base

Given branch contributing-documentation and prior merge base master, calling git changes master --diff or git changes master --stat will show changes from master.

$ git log --oneline
743bc66 Fix documentation typo
916b18d Update documentation
b2c7c4b Initial commit
$ git show --stat
commit 743bc666f7d135bb3a5570dcee37e17114962234
Author: Marcus Rosenow <[email protected]>
Date:   Thu Mar 24 11:04:46 2016 -0500

    Fix documentation typo

 README.md | 2 --
 1 file changed, 2 deletions(-)
$ git checkout contributing-documentation 
Switched to branch 'contributing-documentation'
$ git log --oneline
916b18d Update documentation  # NOTE: one behind master
b2c7c4b Initial commit
$ git changes  # no changes
$ git changes --stat  # but stat shows changes
 README.md | 2 ++
 1 file changed, 2 insertions(+)
$ 

Get upstream for arbitrary branch

Rather than only getting the upstream for the current branch, add the ability to specify the branch:

$ git upstream --branch fix-issue

Changes' man page is missing argument name.

The branch flag is missing the argument name:

-b|--branch
    Show the commits between HEAD and branch. When not specified, master is used.

It should be:

-b|--branch <branch>
    Show the commits between HEAD and branch. When not specified, master is used.

Status cannot be ordered

Including "status" in a custom order does nothing.

$ git state --order status log
# log

    38ed6ca Merge branch 'order-option'
    a927e24 Update changelog
    b59db27 Update documentation
    1bf6fc3 Add a flag to define section order
    ad502ea Fix changelog
    880adbe Merge branch 'custom-ordering'
    af47718 Update changelog
    c6b7dc8 Update documentation
    afc5348 Add custom section ordering
    326af15 Merge branch 'extension-name'

# status (master...origin/master)

# branches

    * master 38ed6ca [origin/master] Merge branch 'order-option'

Show clean directory message

Add the option to show a clean directory message rather then nothing. Similar to git status:

$ git state -BRTL
# status (master...origin/master)

    nothing to commit, working directory clean

Make it configurable using git-state.status.show-clean-message <bool>

Add global debug configuration

Rather than having to specify --debug=~/.git-commands.log with each command, a global option would be used to always log.

$ git config --global git-commands.log "~/.git-commands.log"

This may also make a --no-debug flag useful.

Settings cleanup fails when the file starts with a comment or whitespace

# aliases
[alias]
    c = commit
$ git settings cleanup ~/Desktop/config_copy
Traceback (most recent call last):
  File "/Users/marcus/Development/python/git-commands/bin/git-settings", line 146, in <module>
    main()
  File "/Users/marcus/Development/python/git-commands/bin/git-settings", line 143, in main
    func(**args)
  File "/Users/marcus/Development/python/git-commands/bin/commands/settings.py", line 161, in cleanup
    config[key] += [line + os.linesep]
KeyError: None

git-snapshot pop mentions dropping a stash

The final line of a pop reads:

Dropped stash@{2} (c7aab1815f8870bcd4a00c09f0720dd11a0bb7ac)

it should read:

Dropped snapshot@{2} (c7aab1815f8870bcd4a00c09f0720dd11a0bb7ac)

Make tuck's output similar to stash's

Rather than printing the tucked files:

Tucked files: file1.txt CHANGELOG.md

Print something similar to git-stash:

Saved working directory and index state WIP on master: a7834c6 Initial commit
HEAD is now at a7834c6 Initial commit

Typos exist in state's man page

git-state.log.count int
    The default log length. Can be overridden using the -d|--log count option.

    Default: 10

The short option is -l not -d.


color.ui string
    Determines whether or not colors are printed in the output. Options --color and --no-color override this value.

    Default: auto

The color flag supports a <when> option and should be --color [<when>].

git-state errors out when run from a non-git directory

$ git state
error: could not lock config file .git/config: No such file or directory
fatal: Not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
  File "/Users/Marcus/Development/bash/git-commands/bin/git-state", line 232, in <module>
    main()
  File "/Users/Marcus/Development/bash/git-commands/bin/git-state", line 229, in main
    state.state(**vars(parser.parse_args()))
  File "/Users/Marcus/Development/bash/git-commands/bin/commands/state.py", line 119, in state
    status = check_output(['git', 'status', '--short', '--untracked-files=all', '--branch']).splitlines()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['git', 'status', '--short', '--untracked-files=all', '--branch']' returned non-zero exit status 128

Fix tuck printing unrelated files in output

When using a pathspec, the output text prints more than is should:

$ ls
README.md   file1.txt   file2.txt
$ git status --short
 M README.md
?? file2.txt
$ git tuck -- *.txt
Tucked files: file2.txt file1.txt
$ git diff --name-only stash@{0}
README.md

file1.txt wasn't stashed but shouldn't be in the output either. While #31 will make this irrelevant. The fact that unrelated files are in the file list is worth looking into. It could cause other issues.

Settings cleanup cannot be run in a non-git repo

Since cleanup currently doesn't support --system, --global, or --local, it's effectively independent of a specific repository and should run as such.

$ pwd
/Users/marcus/Desktop
$ git settings cleanup '~/.gitconfig'
error: '/Users/marcus/Desktop' not a git repository

The underlying issue is how the default command line arguments are loaded.

Add tags extension

$ git state --tags
# status (state-tags)

    nothing to commit, working directory is clean

# tags

    c7153eb v0.1.0
    9d02c56 v0.2.0
    29182eb v0.3.0
    b8cd205 v0.4.0
$

Allow config values to be case insensitive

The Python re-write made it so config values need to be case sensitive. Therefore, setting the following state setting:

$ git config --local git-state.reflog.show true

causes an error when running the command.

The case shouldn't matter.

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.