我之前遇到了一个不寻常的git问题,我已经解决了,但我仍然很好奇它为什么会发生.
当我意外删除了当前正在处理的分支时,问题就出现了.通常git不允许这样做,但是由于OSX上的大小写不敏感,我让自己进入了一种情况,我认为我有两个分支,一个命名feature/ONE,另一个命名feature/one.认为这是两个独立的分支(来自一个主要是linux /区分大小写的背景),我正在使用功能/ ONE我试图删除功能/一个使用git branch -D.
我很快注意到我做了什么,试图找回我丢失的作品git reflog,这给了我错误fatal: bad default revision 'HEAD'.我试图恢复正常状态使用git checkout -f develop,这是有效的.但是,当我看到git reflog这个之后不幸的是它只有一个条目说明checkout: moving from feature/ONE to develop.日志中没有出现先前的操作.
我已经编译了一些步骤来复制这种场景(可能只有在不区分大小写的文件系统上才有可能):
mkdir test
cd test
git init
echo 'hi' > file1
git add file1
git commit -m 'test commit 1'
git checkout -b new-branch
echo 'test2' > file2
git add file2
git commit -m 'test commit 2'
git branch -D NEW-branch
git checkout …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个Sublime Text 3插件,该插件将输出写入当前窗口中的输出面板.我发现了许多使用begin_edit和end_edit执行此操作的示例,这些示例在ST3中不再受支持.据我了解,ST3要求我定义一个TextCommand以支持我的输出面板上的编辑操作.到目前为止,我所拥有的是:
class SfprintCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.insert(edit, self.view.size(), 'hello')
class SfCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.panel = self.view.window().create_output_panel('sf_st3_output')
self.view.window().run_command('show_panel', { 'panel': 'output.sf_st3_output' })
self.panel.run_command('sfprint');
Run Code Online (Sandbox Code Playgroud)
我希望这应该在我的输出面板中打印文本"hello",但是当我尝试通过控制台(通过运行view.run_command('sf'))调用它时,这将显示新面板但不会向其打印任何信息.如何在此面板中写入文字?
在我的Spring XML中,我有以下代码段:
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="useDefaultSuffixPattern" value="false"/>
</bean>
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
<property name="objectMapper" ref="objectMapper" />
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
Run Code Online (Sandbox Code Playgroud)
据我了解,这意味着春天应该不登记"ABC*"和"ABC /"当我有"ABC"的映射.
在我的一个控制器中,我有一个将图像写入响应的方法:
@RequestMapping(value="{path}", method=RequestMethod.GET, produces=MediaType.IMAGE_PNG_VALUE)
@ResponseBody
public void getPath(
@PathVariable String path,
HttpServletResponse res) {
...
}
Run Code Online (Sandbox Code Playgroud)
当我请求像"abc"这样的东西时,这很有用,但是当我请求"abc.com"时,它会在文本中抛出406错误:
The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers."
Run Code Online (Sandbox Code Playgroud)
当我请求"abc.img"时,"path"参数只接收文本"abc"; Spring省略了扩展名.
看来Spring似乎没有正确地忽略后缀模式.为什么是这样?
编辑:我从Dirk的评论中翻译了java配置,以下XML似乎解决了这个问题:
<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<property name="favorPathExtension" value="false" />
</bean>
<mvc:annotation-driven content-negotiation-manager="contentNegotiationManager">
<mvc:message-converters>
<bean …Run Code Online (Sandbox Code Playgroud) git ×1
git-reflog ×1
java ×1
macos ×1
python ×1
spring ×1
spring-mvc ×1
sublimetext3 ×1
uri ×1