Giter Club home page Giter Club logo

commit-comments's Introduction

JRY

Installation

  • zola: brew install zola
  • cargo-make: cargo install --force cargo-make
  • tailwind cli: See below
curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-macos-arm64
chmod +x tailwindcss-macos-arm64
mv tailwindcss-macos-arm64 tailwindcss

commit-comments's People

Contributors

jryio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

commit-comments's Issues

Files that aren't in the commit are searched for commit comments

$ git commit
.git/hooks/prepare-commit-msg: line 43: conditional binary operator expected
.git/hooks/prepare-commit-msg: line 43: syntax error near `=~'
.git/hooks/prepare-commit-msg: line 43: `  if [[ "${IGNORED[*]}" =~ "${filename}" || "${IGNORED[*]}" =~ "${extension}" ]]; then'

$ cd ../commit-comments/
$ git log | head -n 1
commit a916600e8cc2b0cb0f6da2533d616da3ddca5f68

$ /bin/bash --version
GNU bash, version 3.1.20(4)-release (i686-pc-msys)
Copyright (C) 2005 Free Software Foundation, Inc.

Running

#!/bin/bash
ADDED_FILES=( $(git ls-files) )
echo $ADDED_FILES
echo '************'
for i in ${!ADDED_FILES[@]}; do
  file_path=${ADDED_FILES["$i"]}
  filename=$( basename "$file_path" )
  extension="${filename##*.}"
  echo $file_path
  echo $filename
  echo $extension
  if [[ "${IGNORED[*]}" =~ "${filename}" || "${IGNORED[*]}" =~ "${extension}" ]]; then
    # File should not be read - remove
    unset ADDED_FILES["$i"]
  fi
done

gives

$ . test.sh
.gitignore
************
sh.exe": ./test.sh: line 12: conditional binary operator expected
sh.exe": ./test.sh: line 12: syntax error near `=~'
sh.exe": ./test.sh: line 12: `  if [[ "${IGNORED[*]}" =~ "${filename}" || "${IGNORED[*]}" =~ "${extension}" ]]; then'

Overzealous commits when using `git add --patch`

When using git add --patch commit-comments from outside the current patch are added to the commit message and all commit tags are removed, not just those from the current patch.

For example, say I have the following diff of a file in my repo:

 #! /usr/bin/env python

+#@commit greeting alice
+print("Hi Alice")
+
 print("Hello World")
+
+#@commit say goodbye
+print("Goodbye World")

I add the first hunk using git add --patch, but ignore the second hunk.
The commit message I get is:

 - [test.py#3] greeting alice
 - [test.py#8] say goodbye

And after removing the commit-comments the file looks like:

#! /usr/bin/env python

print("Hi Alice")

print("Hello World")

print("Goodbye World")

The correct behaviour should be for the commit message to be:

 - [test.py#3] greeting alice

And the file to be:

#! /usr/bin/env python

print("Hi Alice")

print("Hello World")

#@commit say goodbye
print("Goodbye World")

(Loving the tool by-the-way!)

Any plans to support Windows?

I am very fond of this functionality as it always seemed to me like i actually forget the details of the change during commit. And as its implemented right now using bash scripts, i doubt it will be easy to port to Windows systems. That would have been really great if it supported both systems. But i would still like to know if something like that is in the pipeline?

pcregrep not found in post-commit

Hi Jacob,

I just tried your scripts and wanted to let you know that you get the following error message in case you do not have pcregrep installed (on commit obviously):

.git/hooks/post-commit: line 15: pcregrep: command not found

Maybe I'll make a pull request with a patch later, but wanted to anyway already document to error.

Regards

Multiline commit messages

Among other weirdness I encountered, it appears multiline commit messages aren't supported, or I used the wrong syntax. Would be a great feature to have, as I instinctively wrap lines to 80 characters. (I realize how stupid this sounds given the fact that the point of these hooks are to remove the comments before committing.)

OSX: sed -r isn't available

The post-commit hook gets me this:

sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]

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.