当我运行git ls-files -m
时,不显示新文件(无论是否上演)。显示修改过的文件。
这是:
可能导致此行为的原因是什么?
我已经尝试了新的存储库并删除了我的~/.gitconfig
:这一切都没有帮助。
我还尝试了一个全新的Mac用户(和一个新的回购),令人惊讶的是,这种行为仍然存在。
答案 0 :(得分:4)
// Create one global variable
var lib = {};
(function ( lib ) {
lib.autocapitalize_element = function (element) {
var val = element.value.toLowerCase();
var split_identifier = " ";
var split = val.split(split_identifier);
for (var i = 0; i < split.length; i ++) {
var v = split[i];
if ( v.length ) {
split[i] = v.charAt(0).toUpperCase() + v.substring(1);
}
};
val = split.join(split_identifier);
element.value = val;
}
lib.autocapitalize_helper = function(element) {
element.onkeyup = function(e) {
var inp = String.fromCharCode(e.keyCode);
if (/[a-zA-Z0-9-_ ]/.test(inp)) {
lib.autocapitalize_element(element);
}
};
}
lib.autocapitalize = function() {
var elements = document.querySelectorAll("input[autocapitalize], textarea[autocapitalize]");
for(var i = 0; i < elements.length; i++) {
lib.autocapitalize_helper(elements[i]);
lib.autocapitalize_element(elements[i]);
}
}
lib.domReady = function(callback) {
document.readyState === "interactive" || document.readyState === "complete" ? callback() : document.addEventListener("DOMContentLoaded", callback);
};
}( lib ));
// This function gets called when the dom is ready. I've added it to the lib variable now because I dislike adding global variables, but you can put it anywhere you like.
lib.domReady(function() {
lib.autocapitalize();
});
不应该显示新文件。只有在暂存后修改了git ls-files -m
时,新文件才会出现在git ls-files -m
的输出中:
$ git init test
Initialized empty Git repository in /tmp/test/.git/
$ cd test/
$ git ls-files -m
$ touch newfile
$ git ls-files -m
$ git add newfile
$ git ls-files -m
$ echo sometext >> newfile
$ git ls-files -m
newfile # <----