Skip to content

Conversation

@winfinit
Copy link

No description provided.

@xoorath
Copy link

xoorath commented Dec 5, 2015

@winfinit Hey, thanks for this - works like a charm. The only thing I'd change is using a double quote instead of single quote in the command string, otherwise it wont work on windows. Once that change is made the windows version is plug and play. 🍰 🎉 🎈

@xoorath
Copy link

xoorath commented Dec 5, 2015

And now that I'm playing with it, I'd also add a limit to the method. This way you can specify how many logs to show. 🌵

  , log : function (cb, limit) {
      var cmd_string = 'git log --no-color --pretty=format:\"%H  |  %cr  |  %an  |  %s\" --abbrev-commit';
      if(limit != null && !isNaN(limit))
      {
        cmd_string += ' -'+limit;
      }
      _command(cmd_string, function (str) {
        var logs = [];
      if ( str !== null ) {
          (str.split('\n')).forEach(function(line, line_idx) {
              var parsed_line = line.split('  |  ');
              logs.push([
                  parsed_line[0],
                  parsed_line[3],
                  parsed_line[1],
                  parsed_line[2]
              ]);
          });
        };
      cb(logs);
      });
   }

@winfinit
Copy link
Author

winfinit commented Dec 5, 2015

thank you, your change is incorporated in this pull request.

@tblobaum
Copy link
Owner

tblobaum commented Feb 5, 2016

Thanks!

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.

3 participants